I have this table:
ip country
1 A
2 A
3 B
4 B
4 B
I am trying to write a query, which will return something like:
A 1,2
B 3,4
E.g. SELECT * FROM table GROUP BY
country returns:
A 1
B 3
But it's not the desired result.
Ι can run this simple query:
SELECT * FROM table ORDER BY ip
and programmatically will write something like:
$c_ip=0;
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
if($row['ip'])!=$c_ip)
{
$c_ip=$row['ip'];
//new line!!
}else
{
//don't close <tr> code goes here
}
}