我在c#中有一个查询。我可以在datagridview中看到数据。这是我的代码
select welding_date
, (select SUM(mat_2_size)
from fabrication_table fab_2
where fab_1.welding_date = fab_2.welding_date
and (fab_2.welder_1 like '%" + welder + "%' or fab_2.welder_2 like '%" + welder + "%'))as 'TOTAL
SUM'
,(select SUM(mat_2_size)
from fabrication_table fab_2
where mat_2='AS' and fab_1.welding_date = fab_2.welding_date
and (fab_2.welder_1 like '%" + welder + "%' or fab_2.welder_2 like '%" + welder + "%'))
as 'SUM OF AS'
,(select SUM(mat_2_size)
from fabrication_table fab_2
where mat_2='SS' and fab_1.welding_date = fab_2.welding_date
and (fab_2.welder_1 like '%" + welder + "%' or fab_2.welder_2 like '%" + welder + "%'))as 'SUM OF SS'
,(select SUM(mat_2_size)
from fabrication_table fab_2
where mat_2='CS' and fab_1.welding_date = fab_2.welding_date
and (fab_2.welder_1 like '%" + welder + "%' or fab_2.welder_2 like '%" + welder + "%')) as 'SUM OF CS'
from fabrication_table fab_1
where welding_date between @date1 and @date2
group by welding_date order by welding_date
这是我在datagridview上的结果
http://enderaric.com/calisma/q.PNG
现在我想在Crystal Report上看到这个表。这是一个紧急的声明!
我的问题摘要我有一个表格,包括mat_2_size,mat_2,welding_date,welder_1,welder_2,我想总计mat_2_size @ date1和@ date2之间的范围,mat_2 = CS或AS或SS的总大小。我想显示这样的每一行 日期,总和,mat_2 ='CS'的总和,mat_2 ='AS'的总和,mat_2 ='SS'的总和
答案 0 :(得分:0)
将此作为您的where语句:
where datediff(day,@date1,weldingdate) >= 0
and datediff(day,weldingdate,@date2) >= 0