2014-01-25 199 views
0

我有mysql的一個查詢在那裏我取多少已經銷售總額不見了,MySQL查詢Select語句幫助需要

,但它顯示previous dates [Date] => 2014-01-22[TotalSales] => 7

它顯示了這種方式,我怎樣才能使它,因此,它顯示當天的日期,並顯示銷售到現在

SELECT DATE(order_time) AS Date, SUM(Quantity) AS TotalSales 
FROM ss_orders,ss_ordered_carts 
GROUP BY date; 

回答

0

然後添加一個WHERE子句,你order_time今天的日期比較。 是這樣的:

SELECT DATE(order_time) AS Date, SUM(Quantity) AS TotalSales 
     FROM ss_orders,ss_ordered_carts 
     WHERE DATE(order_time) = DATE(NOW()) 
     group by date; 
+0

感謝:D,你讓我的日子:D乾杯! – user3234335

+0

沒問題,歡迎:) – RicardoE