On the forum saw a similar split to view the results of the stem for a moment preface to cure
Like a B watch.
Table A
Id,name
1,a
2,b
3,c
B table
Fk_id,type,value
1,socer,100
1,socker,90
2,socker,20
To find such a result
A.id,a.name,a.socker
1, A, ' 100,90 '
2,b, ' 20 '
That's when the select was made a field socker the column values of table B into a row, using the "," symbol to split. Request SQL Statement Thanks
Handwritten tablesCreate TableA (IDint(Ten) not NULLauto_increment, NAMEvarchar( -), Primary Key(ID));Create TableB (fk_idint(Ten) not NULLauto_increment, TYPEvarchar(Ten),
VALUEvarchar (10)
);
Implement SQL as follows ①
SELECT a.id, a.name, as sockerfrom A INNER JOINon= b.fk_idGROUP by a.id, A . NAME
Implement SQL as follows ② support output write into hard drive path
SELECTa.ID as 'a.id', A.name as 'A.name', Group_concat (b.value) as 'A.socker' fromA, bWHEREa.ID=b.fk_idGROUP bya.id, A.name intoOUTFILE "D:/NEWS. SQL ";
"MySQL" statement optimization