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
Do I have to select a predefined Identity field when using the SELECT INTO clause in a SQL Server stored procedure ?
any body able to help truobleshoot error "Server Application Unavailable"
Silverlight File Upload with Progress Bar
IE7 and blank pages
VBA using Search Worksheet Function to Find Question Marks (Tilde)
Issue with License Activation - How do you add computers to KMS pool?
Select table data from a different SQL instance?
Excelhow to convert number of days to weeks and days.
Visual Studio 2005, Crystal Report Viewer 10, displaying dynamic image
Excel.exe caused a Fatal Exception Error