Following is my sql query in which i am trying to get the names of those people whose address is same but the problem i faced is that the query is showing the right count but all the names are not there grouped by and not in the following manner. Kindly let me know how can i modify the following query so i can get the address in a manner mentioned below and also count(address) = 1 should be ignored. Thanks,
+---------------------+ Jhon | Stree 9, H#4 zame | Stree 9, H#4 sinn | Stree 9, H#4 linn | Stree 8, H#9 tinn | Stree 8, H#9 +---------------------+
SELECT *,count(address) FROM `student`
group by address
order by count(address) desc
SQLFIDDLE: http://sqlfiddle.com/#!2/6d6ca/2
Try this:
EDIT:
do you mean this group_concat ?
DEMO HERE