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.
| Author |
Topic |
|
paull
Yak Posting Veteran
50 Posts |
Posted - 2009-08-06 : 12:10:37
|
| Hi guysI populate a table from a number of other tables to form a "Master_Final" table. I only want records where the count of a particular varible is greater than 5. I am trying to find a way to use either SELECT * WHERE COUNT ...(in the INSERT statement) or DELETE FROM WHERE COUNT ... (after the INSERT) so that only the records I need are actually in the table. I cannot find an example of this being done!!Any help or advice is much appreciated.ThanksP |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-08-06 : 14:11:02
|
>>where the count of a particular varible is greater than 5Do you mean that you want only rows where the occurrence of a particular column value exists for at least 5 different rows?maybe something like this:select type, name from sysobjects where type in ( select type from sysobjects group by type having count(*) >= 5 )order by type Be One with the OptimizerTG |
 |
|
|
paull
Yak Posting Veteran
50 Posts |
Posted - 2009-08-10 : 10:27:24
|
| Hi TGSorry for not replying sooner! I tried that and it works perfectly!Many, many thanks for your help! |
 |
|
|
|
|
|