September 2, 2006 at 3:27 am
Dear Friendz,
Need help in building a query. I've 2 tables with the following strucuture..
mstBranch ( BranchID PK IDENT INT , BankCode V(50) N.N. , BankName V(100) N.N. , BranchCode V(50) N.N. , BranchName V(100) N.N. )
IndSales ( IndSalesID PK IDENT INT , BankCode V(50) N.N. , BranchCode V(50) N.N. , ProductCode V(50) N.N. , PolicyNo V(50) , Premium NUMERIC(18,2) N.N. )
Each table will have 14000+ records. Now i need to all the records from IndSales which are not in mstBranch.
There are indirectly linked with BankCode & BranchCode fields. I know i can do it with using correlated queries, but i want to know is there is any other way i can do this?
Thanks in advance.
Regards,
Ramesh
--Ramesh
September 2, 2006 at 9:28 pm
SELECT i.*
FROM IndSales i
LEFT OUTER JOIN mstBranch b
ON i.BankCode = b.BankCode
AND i.BranchCode = b.BranchCode
WHERE b.BankCode IS NULL
--Jeff Moden
Change is inevitable... Change for the better is not.
September 4, 2006 at 12:23 am
Jeff,
Thanks for the query...
--Ramesh
--Ramesh
September 4, 2006 at 8:41 am
You bet, Ramesh... thank you for the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply