Microsoft
Software
Hardware
Network
Question : SQL select problem, if and only if using SQL 2005
I need to select contacts that have a subset of specific source codes (i.e. 'DFG20065', 'DS2456jsldf') but do not have any other records with different codes such as 'DTGHS35'.
For example,
select contactid, source from credhistory where
source in ('DFG20065', 'DS2456JSLDF')
is my initial select. However, I need to select contacts with these two and only these two source codes.
Can anyone help?
Thanks!
Answer : SQL select problem, if and only if using SQL 2005
select contactid, source from credhistory where
source in ('DFG20065', 'DS2456JSLDF')
and not exists (select 1 from credhistory where source not in ('DFG20065', 'DS2456JSLDF') )
Random Solutions
Why does Excel crash while running Excel macro?
Speeding up a SQL Server 2008 Database?
Good practice on writing file, creating directory, etc.
Automatic backup for the folders on network
Excel macro to update cell information
Convert VBA to VB.Net
How do I restore "send to mail recipient"
run a dll as an app keeps appearing when I want to do ANY window operation!
Single quotation in strVariable causes error 2147217900
SSIS insert primary key - there must be a way