Hello,
I'm using PDO_MYSQL in php and i am wondering if there is a way to make a GROUP_BY clause return an array.
Explanation:
I have a one-to-many relation in a table. and i would like to get an array representing the relation.
then i want an array like this:
thank you very much!
guillermobytes
I'm using PDO_MYSQL in php and i am wondering if there is a way to make a GROUP_BY clause return an array.
Explanation:
I have a one-to-many relation in a table. and i would like to get an array representing the relation.
Code:
table1: | car_id | possible_colors | |---------|------------------| | car1 | red | car1 | green | car1 | blue | car2 | red | car2 | yellow
Code:
array('car1'=>array('red','green','blue')
'car2'=>array('red','yellow'));
guillermobytes
Comment