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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2009-10-25 : 09:10:14
|
| what am i doing wrong select participantid,count(participantid) from placements where count(participantid)=1 group by participantidI just want to return all participantid's that have only one reocrds. then I want to do a select * from placments where (and a bunch of criteria here) and participantid in(select participantid,count(participantid) from placements where count(participantid)=1 group by participantid)am i going about this the wrong way? |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-25 : 10:07:16
|
select participantidfrom placements where count(participantid)=1group by participantidhaving count(*) = 1 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-25 : 10:52:42
|
select *from placments pjoin(select participantid from placements group by participantid having count(*) = 1)dton dt.participantid = p.participantid where (and a bunch of criteria here) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2009-10-25 : 10:58:09
|
| thanks how do i fix this i need to have the final query at the end as the sql is generated dynamically from my asp file sql:select count(participantid) as countp from qryplacements where pos like 'F' and participantid is in (select participantid from placements group by participantid having count(*) = 1) and participantid is not null |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-25 : 11:04:50
|
Where is the problem? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2009-10-25 : 11:18:23
|
| i'm getting Incorrect syntax near the keyword 'in'. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-25 : 11:29:59
|
take away the the word 'is'. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2009-10-25 : 13:45:32
|
| thanks :) |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-25 : 14:31:51
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|