用日期明智地计数SQL中的记录 [英] count record in sql with date wise

查看:82
本文介绍了用日期明智地计数SQL中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有两个桌子

1. production_main 2. trackwork_pd

在第一个表中,我维护条形码,品牌,性别信息,在第二个表中,我维护(条形码,productindt和productoutdt).

因此,我想要一个SQL查询,其中用户提供当前日期,并与productindt列进行比较,并按日期对记录进行查询计数,并以类型格式显示并显示产品的品牌和性别.

品牌性别总条形码
艾迪亚斯男29岁

但是我无法进行这种类型的查询,而用户只能输入日期并在查询告诉用户使用哪种品牌和性别的产品总数时显示这种记录.


谢谢

解决方案

这里是一个提示

SELECT [columns], COUNT(column)
FROM table
JOIN table1 ON table.column = table2.column
WHERE date = @date_provided


hi
i have two table

1. production_main 2. trackwork_pd

In first table i have maintain barcode, brand, gender information and in second table i have maintain (barcode, productindt and productoutdt).

So i want a sql query where user give current date and i compare with productindt column and query count the record by datewise and display that is type format and show which brand and which gender total product in.

brand gender totalbarcode
addias male 29

but i not able to make that type of query where user only input date and display this type of record where query tell the user to which brand and which gender total product in.


thanks

解决方案

Here''s a hint

SELECT [columns], COUNT(column)
FROM table
JOIN table1 ON table.column = table2.column
WHERE date = @date_provided


这篇关于用日期明智地计数SQL中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆