seleccionar 1 columna puede coincidir con muchas columnas
Frecuentes
Visto 63 veces
-3
I have the 1 table (tblcsv) in database that have data as below:
fieldA fiel B
aaaa 1
aaaa 2
aaaa 4
a 1
aaaa 2
a 3
bbbb 4
b 3
bbbb 4
b 3
What I need to display:
aaaa 1
2
4
2
a 1
3
bbbb 4
4
b 3
3
I really do not know how to write mysql for query it from database to display what I need.Anyone help me please, Thanks.
3 Respuestas
1
SELECT fieldA, fieldB
FROM tblcsv
order by feildA
Respondido 28 ago 12, 10:08
0
select fieldA , fiel B from table
order by fieldA ;
Respondido 28 ago 12, 10:08
Thanks for your answer,but if I do like this it will loop all record of fieldA that has the same name like aaaa aaaa
for many time.I want it display one time. - user1629258
0
Creo que necesitas GROUP_CONCAT
SELECT fieldA, GROUP_CONCAT(fieldB)
FROM tblcsv
Respondido 28 ago 12, 10:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php mysql sql mysqli or haz tu propia pregunta.
you can get the data by using order by on "fieldA " and then use PHP to format your data - Ankur
.. oreder by fieldA, fieldB - you will have to do the rest with php - user557846