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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to display item if it exists for all (PLEASE HELP)

Status
Not open for further replies.

rnc110

MIS
May 31, 2001
16
US
Hi,

I have a table with 2 attributes: Position# and Course#. Currently there are 42 positions (1-42). I need a query to show the course# if that course # appears for all the positions (1-42).


Thank you in advance
 
I'm sure there is another way to do this but the first thing that pops into my mind is just to see if there are 42 distinct position#s for each course#

SELECT DISTINCTROW Table1.[course#]
FROM Table1
WHERE ((((select count(*)+1 as ct from table1 as q1 where q1.[position#] > table1.[position#] and q1.[course#] = table1.[course#]))=42));

count(*)=1 adds 1 because position#1 would not get counted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top