Mysql查询选择语句帮助需要

时间:2014-01-25 05:12:28

标签: mysql

我有一个mysql的查询,其中我获取总销售额已经消失了多少,

但它显示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;

1 个答案:

答案 0 :(得分: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;