zimmer9
asked on
How to revise an Access 2003 query into a SQL Server 2008 SQL statement?
I have the following Access 2003 query that I am trying to convert to a SQL Server 2008 equivalent:
Access 2003 Query
SELECT B.entity, SV.bank, SV.userid, SV.dtCreated, SV.chkNum,
SV.branch, SV.chkDt, SV.accountNum, SV.amount, SV.typeSV
FROM tbl_CSL_Bank AS B INNER JOIN tbl_CSL_StopVoidPay AS SV ON
B.bankID = SV.bank
WHERE (((SV.typeSV)='S') AND ((Exists (SELECT userID FROM tbl_CSL_Users AS U WHERE
SV.userid = U.userID))=False))
ORDER BY SV.chkNum;
The following statement I created does not filter out records where "SV.userid <> U.userID".
Do you know how this query could be revised to accomplish this?
SELECT B.entity, SV.bank, SV.userid, SV.dtCreated, SV.chkNum,
SV.branch, SV.chkDt, SV.accountNum, SV.amount, SV.typeSV
FROM tbl_CSL_Bank AS B INNER JOIN tbl_CSL_StopVoidPay AS SV ON
B.bankID = SV.bank
WHERE ((SV.typeSV)='S') AND ((Exists (SELECT userID FROM tbl_CSL_Users AS U WHERE
SV.userid <> U.userID)))
ORDER BY SV.userid, SV.chkNum;
Access 2003 Query
SELECT B.entity, SV.bank, SV.userid, SV.dtCreated, SV.chkNum,
SV.branch, SV.chkDt, SV.accountNum, SV.amount, SV.typeSV
FROM tbl_CSL_Bank AS B INNER JOIN tbl_CSL_StopVoidPay AS SV ON
B.bankID = SV.bank
WHERE (((SV.typeSV)='S') AND ((Exists (SELECT userID FROM tbl_CSL_Users AS U WHERE
SV.userid = U.userID))=False))
ORDER BY SV.chkNum;
The following statement I created does not filter out records where "SV.userid <> U.userID".
Do you know how this query could be revised to accomplish this?
SELECT B.entity, SV.bank, SV.userid, SV.dtCreated, SV.chkNum,
SV.branch, SV.chkDt, SV.accountNum, SV.amount, SV.typeSV
FROM tbl_CSL_Bank AS B INNER JOIN tbl_CSL_StopVoidPay AS SV ON
B.bankID = SV.bank
WHERE ((SV.typeSV)='S') AND ((Exists (SELECT userID FROM tbl_CSL_Users AS U WHERE
SV.userid <> U.userID)))
ORDER BY SV.userid, SV.chkNum;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.