Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL subquery with count

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-05 : 08:38:33
Bobby writes "Can I use a single Select statement to select a set of records which satisfies 2 'where conditions' and also where the occurance of a count column is greater than 3.
SELECT * FROM RegWait WHERE NOT Reg_type='S' AND NOT Reg_type='T' HAVING COUNT(po_box)>3
This doesn't work."

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-11-05 : 11:32:03
you need to ask yourself how is po_box related to the records you want....

having count(po_box) > 3....usually (must) goes with a GROUP BY statement....in which you are summarising data...


Are you saying you want records which satsfy the 2 conditions as long as they also occur more than 3 times...in terms of (any/all/one particular) po_box column value?



show us sample data....and sample expected results...and you will get something more helpful....you're query is too vague, and open to many (or no) answer.

Go to Top of Page
   

- Advertisement -