This really should be easy, but I don't seem to get the hang of it.
I have a MySQL db-table as follows:
apartment name
1 smith
1 smith
2 doe
3 larsen
3 brown
I need to create a list that looks like this
doe
brown, larsen
smith
In other words, the list should be ordered by name but names in the same apt should be kept together. Also, if both names in one apt is the same, only one name should be printed out.
I tried ("SELECT * FROM tbl WHERE Apt>=24 AND Apt <=48 GROUP BY Apt ORDER BY Name")
But the GROUP BY isn't correct since it gets rid of one of the names...