A B C
1 1 1
1 1 1
2 2 2
2 2 2
3 3 3
3 3 3
4 4 4
4 4 4
5 5 5
5 5 5
5 5 5
6 6 6
6 6 6
I am to output only the distinct rows without using the group by statement. I cannot use group by because it makes mysql hang. So it should return
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
I am using DISTINCT in for an inner join.This does not work either:
SELECT DISTINCT * FROM TABLEA inner join TABLEB on TABLEA.A = TABLEB.A
According to mysql documentation, DISTINCT specifies removal of duplicate rows from the result set (http://dev.mysql.com/doc/refman/5.0/en/select.html)
I created a sample on jsfiddle and it works IMHO
feel free to experiment on this SQLFiddle.