All the guys probably will recommend that I read the follow previously question in this URL http://senta.la/bd08
So I’m just read them carefully and I’m still with my problem. This situation its not equals of the question mentioned in link above.
See below the records I want to found (marked with *):
ID COURSE OTHERCOLUMN_X OTHERCOLUMN_Y OTHERCOLUMN_Z
123 2111 ... ... ...
*5644 2245 ... ... ...
*5644 2245 ... ... ...
2121 2131 ... ... ...
The previously programmer not thinking use the UNIQUE index to make a compost key to prevent this situation. I know… the good news is that programmer is not a programmer anymore.
This classic query its not provide the result I want…
SELECT id, course FROM mytable
GROUP BY id
HAVING COUNT(id) > 1
I want to see only this results:
ID COURSE OTHERCOLUMN_X OTHERCOLUMN_Y OTHERCOLUMN_Z
*5644 2245 ... ... ...
*5644 2245 ... ... ...
I’m just tried a lot of queries but I can find one that show me the results above.
🙁
To find rows with duplicate
id:To find rows with duplicate
(id, course):