jadams0173
Technical User
- Feb 18, 2005
- 1,210
I have a table with this structure
OrderID Complete
1234 yes
1234 yes
1234 no
5678 no
9123 yes
9123 yes
What I am trying to get back is the OrderID where all the Complete are yes. So from the above my results would be.
OrderID Complete
9123 yes
I'm kinda close but the order ID's like 5678 where there are only one entry still return even though there is a NO in complete column. I've tried modifing the query below to add complete=yes in the subquery but I got an error that said something to the effect of I needed to use the EXISTS reserve work in the main query From clause.
my query so far looks like:
Code:
SELECT OrderID, Complete
FROM tblData
GROUP BY OrderID, PicklistComplete
HAVING OrderID In (SELECT [OrderID] FROM [tblData] As Tmp GROUP BY [OrderID],[picklistcomplete] HAVING Count([orderID])=1))