Re: Transponer multiples registros como columnas
Posted by:
werwer w
Date: September 08, 2013 12:25PM
Me autorespondo!
http://www.artfulsoftware.com/infotree/qrytip.php?id=78
Llevaba varios días buscando una solución y debe ser que es domingo y uno está mas relajado porque la he encontrado a la primera. Me esperaba algo mas complicado pero ha resultado ser sencillo y lo posteo por si a alguien le sirve también:
SELECT
id,
GROUP_CONCAT(if(campo = "superficie", valor, NULL)) AS `Superficie`,
GROUP_CONCAT(if(campo = "habitaciones", valor, NULL)) AS `Habitaciones`,
GROUP_CONCAT(if(campo = "garaje", valor, NULL)) AS `Garaje`
FROM tabla
GROUP BY id;
Saludos!.
Subject
Views
Written By
Posted
28831
September 08, 2013 11:59AM
Re: Transponer multiples registros como columnas
7103
September 08, 2013 12:25PM
4081
September 08, 2013 09:24PM
3327
September 09, 2013 12:19PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.