所有累计次数:
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" + DateTime.Now.Month + "' and day(tb_CreateDate)='" + DateTime.Now.Day + "'";
累计出错01次数
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" + DateTime.Now.Month + "' and day(tb_CreateDate)='" + DateTime.Now.Day + "' and tb_TypeOverrun='" + sOverrun + "'";
累计出错02次数
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" + DateTime.Now.Month + "' and day(tb_CreateDate)='" + DateTime.Now.Day + "' and (tb_TypeHeight='超高' or tb_TypeWidth='超宽' or tb_TypeLong='超长')";
语句我自己都做出来!!但是如何把不同的统计内容一次查询出来!!因为要使用报表,所以....
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" + DateTime.Now.Month + "' and day(tb_CreateDate)='" + DateTime.Now.Day + "'";
累计出错01次数
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" + DateTime.Now.Month + "' and day(tb_CreateDate)='" + DateTime.Now.Day + "' and tb_TypeOverrun='" + sOverrun + "'";
累计出错02次数
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" + DateTime.Now.Month + "' and day(tb_CreateDate)='" + DateTime.Now.Day + "' and (tb_TypeHeight='超高' or tb_TypeWidth='超宽' or tb_TypeLong='超长')";
语句我自己都做出来!!但是如何把不同的统计内容一次查询出来!!因为要使用报表,所以....
union all
select * from B
union all
select * from C
SELECT AA='2008-12-12',BB='2008-12-13',T.AA,T.BB,T.CC FROM T
sql = sql " union all "
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" DateTime.Now.Month "' and day(tb_CreateDate)='" DateTime.Now.Day "' and tb_TypeOverrun='" sOverrun "'";
sql = sql " union all "
sql = "SELECT Count(id) AS WeightNum FROM tb_overrun WHERE month(tb_CreateDate)='" DateTime.Now.Month "' and day(tb_CreateDate)='" DateTime.Now.Day "' and (tb_TypeHeight='超高' or tb_TypeWidth='超宽' or tb_TypeLong='超长')";
sql = sql " order by 1 desc "row1 所有累计次数:
row2 累计出错01次数
row3 累计出错02次数
union
SELECT Count(id) AS WeightNum FROM tb_overrun
WHERE month(tb_CreateDate)='4' and day(tb_CreateDate)='4'
WHERE month(tb_CreateDate)='1' and day(tb_CreateDate)='14'
union all
SELECT Count(id) AS WeightNum ,'2008-12-19' AS Fdate,'2008-12-20' as Tdate FROM tb_overrun
WHERE month(tb_CreateDate)='1' and day(tb_CreateDate)='14' and tb_TypeOverrun='超越'原来要这样!