Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Funky Select statement

Status
Not open for further replies.

gixer

MIS
Joined
Nov 8, 2001
Messages
15
Location
CA
Hi everyone, I need help with a select statement.

records in the details section should have either the iactionid value 117 and 129, or 117 and 37.

A sample looks like this:

icampaignid iactionid
10 117
10 129
11 117
11 37
12 129
13 37

So from the above table there is an error because the icampaignid of 12 and 13 does not have an iactionid of 117 associated with it. How do I find all the icampaignid's that have an iactionid of 37 or 129, but that are missing the iactionid of 117?

Hope this makes sense.

Any help is appreciated!
 
Here is one possibility.

Select *
From YourTable a
Where Not Exists
(Select * From YourTable
Where icampaignid=a.icampaignid
And iactionid=117) Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Hey thanks very much for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top