mysql - Is there any way to get the values of individual rows when using group by? -


let's have following rows in table named stuff:

id1: id1, id2: id2, name: name, something: something1; id1: id1, id2: id2, name: name, something: something2; 

i use following query:

select *  stuff  id1= id1 , id2 = id2 group id1, id2 

it return

id1, id2, name, something2 

is there way me find 'something' column contained other rows, "something1" in case? or enumeration of values?

you can use group_concat comma-separated list of values column:

select id1, id2, group_concat(something) stuff  id1= id1 , id2 = id2 group id1, id2 

Comments