select a.`創(chuàng)建日期`,b.`訂單數(shù)`,c.結算數(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(*) 結算數(shù)
FROM
tkorder where `訂單狀態(tài)`='訂單結算'
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)建日期`
江就十年,鵬脹十年,胡搞十年,溫疫十年,習已為常,強烈忽悠。