|
Posted by David Mackenzie on 11/05/29 11:16
On 18 May 2005 09:09:43 -0700, "Samuel (lets dot monroe at gmail dot
com)" <lets.monroe@gmail.com> wrote:
>If 1, 2 and 3 are the _only_ allowed values for SkillID you can...
>
>SELECT ID, UserID, count(SkillID) FROM <TableName> GROUP BY ID, UserID
>
>Then those rows with a 3 in the third column are what you're looking
>for.
Use HAVING to filter on the result of count():
SELECT ID, UserID, count(SkillID) FROM <TableName> GROUP BY ID, UserID
HAVING count(SkillID)=3
This also assumes a unique constraint on UserID and SkillID preventing
the same SkillID appearing multiple times for one UserID.
--
David ( @priz.co.uk )
[Back to original message]
|