我有这个查询
SELECT Date, IFNULL(Price, '------') AS Price
FROM productHistory
WHERE Date between '2012-08-15' and '2012-08-19' AND Company='AAA' AND Product='PPP'
GROUP BY Date
结果是:
Date.......Price
-------------------
2012-08-15...100,00
2012-08-19...110,00
它应该是这样的:
Date.........Price
-------------------------------------
2012-08-15......100,00
2012-08-16......--------
2012-08-17......--------
2012-08-18......--------
2012-08-19......110,00
我只使用一张桌子,我在这个论坛上检查了类似的问题,但我找不到解决方案。
当我得到这个时,我想做的是在查询中添加更多公司作为列以获得这样的结果。好吧,为此我必须更改查询..
Date.........PriceCompany1.....PriceCompany2.....PriceCompany3
----------------------------------------------------------
2012-08-15......100,00................................100,00..................................100,0
2012-08-16......---------...............................100,00...................................---------
2012-08-17......---------..............................----------.................................110,00
2012-08-19......110,00..............................100,00..................................----------
我需要做什么?