Solved

TSQL Not In Type

Posted on 2014-04-26
3
283 Views
Last Modified: 2014-04-30
Hello All,

There are two tables having several columns. Now there are three column - account,product,month in both of the tables tblA and tblB.

I want to find out all the rows for the combination of account,product and month which is in tblA BUT not in tblB

Any ideas?
0
Comment
Question by:Rayne
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ProjectChampion earned 500 total points
ID: 40025210
Try this:
Select A.*
From tblA A Left Outer Join tblB B
On A.Account = B.Account And A.Product = B.Product And A.Month = B.Month
WHERE B.Account Is Null;
0
 

Author Comment

by:Rayne
ID: 40025243
Thank you Dara
0
 

Author Comment

by:Rayne
ID: 40033932
Thank you sire, your help saved me big time :)
Thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now