php - GROUP BY mysql showing only one row. But want repetitions also -


my table structure

id  order_id  location time    date  1   951        x              2/03/2013  2   951        x      13:00   2/03/2013  3   951        y              3/03/2013 

i want show these in php group date like

date 2/03/2013 orderid 951 location x orderid 951 location x  date 3/03/2013 orderid 951 location y 

mysql query im performing

select * table order_id=951 group date order id asc 

but query return first row of same data . how can show repetition in group date category. how use in php show data taking date separate variable.

i editing question let know date can want order id show date in group including repetition.

if want show rows in table, better order date, id grouping in php.

$result = mysql_query("select * table order data asc,id asc"); $last_date = ""; while(($row=mysql_fetch_assoc($result))) {     if($last_date != $row['date'])     {         echo "date " . $row['date'] . "\n";     }     echo "orderid ". $row['order_id']." location " . $row['location']. "\n"; } 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -