MySQL Group by one column, but select all data

后端 未结 3 1382
无人共我
无人共我 2021-01-12 04:42

I\'ve got a database which contains lots of data. I would like to select all data, but Group by one column.

So for example:

column a | column b
examp         


        
3条回答
  •  再見小時候
    2021-01-12 05:41

    The example live of accordion: http://jsfiddle.net/WMUJ3/207/ Just implement in code below. ;)

    The code to mount data:

    
    
        Your page
    
        
    
            
    {$row->column_a}"; //This get the values with column a some value $sql2 = "SELECT column_b FROM table WHERE column_a LIKE '%{$row->column_a}%'"; $result2 = mysql_query($sql2) or die(mysql_error()); $html .= '
      '; while ($row2 = mysql_fetch_object($result2)) { $html .= '
    • {$row2->column_b}
    • '; } $html .= '
    '; } return $html; } ?>

提交回复
热议问题