Bonjour Jim,
Le jeudi 1 août 2002 à 21:07:32, vous écriviez :
JM> what kind of select can i do to get:
JM> Day CustA CustB CustC
JM> 1 5 8 4
JM> 2 4 3 7
JM> 3 9 2 1
This one :
SELECT day,
SUM(CASE WHEN customer='CustA' THEN widgets ELSE 0 END) AS "CustA",
SUM(CASE WHEN customer='CustB' THEN widgets ELSE 0 END) AS "CustB",
SUM(CASE WHEN customer='CustC' THEN widgets ELSE 0 END) AS "CustC",
SUM(1) as Total
FROM DATA
GROUP BY day
See : http://php.weblogs.com/ADOdb_manual#pivot
--
Cordialement,
Daniel mailto:pgsql@ajornet.com