橫幅聯(lián)合
select a.`創(chuàng)建日期`,b.`訂單數(shù)`,c.結(jié)算數(shù),d.失效數(shù),e.付款數(shù)FROM
(SELECT
tkorder.`創(chuàng)建日期`
FROM
tkorder
group by tkorder.`創(chuàng)建日期`) AS a
LEFT JOIN (
SELECT
tkorder.`創(chuàng)建日期`,
count(*) 訂單數(shù)
FROM
tkorder
group by tkorder.`創(chuàng)建日期`
) AS b ON a.`創(chuàng)建日期`= b.`創(chuàng)建日期`
LEFT JOIN (
SELECT
tkorder.`創(chuàng)建日期`,
count(*) 結(jié)算數(shù)
FROM
tkorder where `訂單狀態(tài)`='訂單結(jié)算'
group by tkorder.`創(chuàng)建日期`
) AS c ON a.`創(chuàng)建日期`= c.`創(chuàng)建日期`
LEFT JOIN (
SELECT
tkorder.`創(chuàng)建日期`,
count(*) 失效數(shù)
FROM
tkorder where `訂單狀態(tài)`='訂單失效'
group by tkorder.`創(chuàng)建日期`
) AS d ON a.`創(chuàng)建日期`= d.`創(chuàng)建日期`
posted @ 2013-09-17 14:13 強(qiáng)強(qiáng) 閱讀(455) | 評論 (0) | 編輯 收藏