I joined a table to itself to find duplicate rows
select a.data, a.rowNumber, b.rowNumber
from DuplicateRows as a
join DuplicateRows as b
on
a.data = b.data and a.Id != b.Id
group by a.data, a.rowNumber, b.rowNumber
This query gives the results like
"content" | 1 | 2
"content" | 1 | 6
"content" | 2 | 1
"content" | 2 | 6
...and so on
Howcome I rewrite it to have results formed like
"content" | 1 | 2, 6
EDIT
I think the question should be a little bit corrected. You see I don't want to get the inversed result, I mean I just want to get one entry
`1 -> 2, 6`
not
`1 -> 2, 6 and `2 -> 1, 6`
Thanks!
use
GROUP_CONCAT
SQLFiddle Demo
According to your latest edit, I think this is what you'll be needing:
SQLFiddle Demo
PS
I used(and modified) John Woo's table a little bit.
EDIT
A relatively better results from this query:
The fiddle is here.
try GROUP_CONCAT function in mysql