I have a table, UserInfo, in a MySql db that has 6000+ records with duplicate data in one column, UserID. I wrote some SELECT code, below, which appears to return all the rows where UserID is duplicated as it should, but the records are not in order. I need to display the records in UserID order, so that if, for example, there are three rows with UserID=1 they are returned first, and so on. I can't seem to see what I'm doing wrong. Any help would be appreciated. Thanks.
SELECT UserInfo.*
FROM UserInfo
JOIN
(
SELECT UserID
FROM UserInfo
GROUP BY UserID
HAVING COUNT(*) > 1
ORDER BY UserID
)
AS dt USING (UserID)