表A如下:
工单 制令号 不良代码
GD001 1 NULL
GD001 1 &nb ......
表数据
a b
IN201001080044 NULL
IN201001080044 88054795
IN201001080044 88054794
IN201001080044 88055071
IN201001080044 NULL
IN201001080044 NULL
IN201001080044 NULL
IN201001080044 88054791
IN201001080044 21050 ......
原表
CustomerNo CustPN SevecoRFQ QuoteDate QuoteRev
H0008 TH115-AF-240D/U 1000724500 2010-01-22 C   ......
在Time表中有year、month、day三个字段分别存储年月日数据,
现在要根据用户输入的年月日数据,查询大于如“2008-01-01”,的结果
用sql语句怎么实现?
select * from tb where year>datepart(yy,'2008-01-01') and month>datepart(mm,'2008-01-01') and day>datepart(dd,'2008-01 ......
我现在发现我的语句存在以下问题,首先是原始语句:
select A.thetypename, isnull(B.total,0) as inventory from typeTable A left join(select thetypename, sum(case when operation = '入货' then goodsnum else - goodsnum end) + isnull((select jiandangkucun from typeTable where thet ......
一个表,表里有id,date,status3个字段,想统计出group by id,date后,status = 1 和status = 0时,分别有几条记录?
id date status
01 22 1
01 22 0
01 33 1
01 33 1
02 22 1
02 22 0
结果应该是
id date Num1 Num0
01 22 1&nb ......