我使用下面的查询来获取我的表显示出两个日期
SELECT
b.sales_title,c.cat_name,COUNT(b.sales_id) as cnt,COUNT(DISTINCT e.comment_id) as coun
FROM tb_sale_report a
INNER JOIN tbl_sales b on a.sales_id=b.sales_id
INNER JOIN tb_category c on c.cat_id=b.category_id
LEFT JOIN tb_comment e on b.sales_id=e.sales_id
GROUP BY b.sales_title
+------------+---------+--------+------+
| sales_title | cat_name| cnt | coun |
+-------------+---------+--------+------+
| My Sales |Toys |20 |5 |
| First Sale |Dress |28 |1 |
|Premium |Computer |7 |16 |
+-------------+--------+---------+------+
现在的结果之间筛选MySQL的结果tb_sale_report
我也有一个名为view_date
另一场将存储的日期在其中记录ID添加。现在我打算在tb_search_report
表中添加一个筛选选项,用户可以在其中搜索在特定日期(例如开始日期和结束日期)之间添加的记录。我如何编写where
条件来根据指定的日期过滤结果。 需要帮助。提前感谢。
非常感谢。它达到了目的。 – 2012-02-29 09:45:51