This is a discussion on Question on MySQL SELECT within the PHP General forums, part of the PHP Programming Forums category; Hi everyone, I have created a table with the following 3 columns ID UserID SkillID 1 2 1 1 2 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
SELECT UserID, count(*) FROM t WHERE UserID >= 1 AND UserID <=3 GROUP BY UserID HAVING count(*) = 3 This will return all user IDs that have 3 records of user ids between 1 and 3. The only reason is wouldn't work is if there were repeated rows with the same userid and skillid. |