注册 登录
编程论坛 VB6论坛

如何将日期between的2个日期也显示在datagrid上

w360989426 发布于 2014-02-09 16:15, 366 次点击
sql1 = "select 酒店名称,sum(送货单总额) from 财务应收 where 日期 between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "'and 入账日期 is null and 送货数量 is not null group by 酒店名称"""
    Adodc1.RecordSource = sql1
    Adodc1.Refresh
我想让日期between 的2个日期也显示在datagrid上,与每条记录相对应,请问我这个语句该如何写才能达到目地谢谢啊!
3 回复
#2
lowxiong2014-02-09 22:31
sql1 = "select 酒店名称,sum(送货单总额)," &DTPicker1.Value &" as 比较日期1," & DTPicker2.Value & " as 比较日期2 from 财务应收 where 日期 between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "'and 入账日期 is null and 送货数量 is not null group by 酒店名称"""
    Adodc1.RecordSource = sql1
    Adodc1.Refresh
#3
w3609894262014-02-10 10:10
回复 2楼 lowxiong
谢谢版主指点,昨晚想到一个解决方法:select min(日期) as 起始日期, max(日期) as 终止日期,酒店名称,sum(送货单总额) as 区间总额,入账日期 from 财务应收 where 日期 between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "'and 入账日期 is null and 送货数量 is not null group by 酒店名称,入账日期
与版主的大差不差!
呵呵谢谢
#4
Artless2014-02-10 12:05
以下是引用w360989426在2014-2-10 10:10:50的发言:

谢谢版主指点,昨晚想到一个解决方法:select min(日期) as 起始日期, max(日期) as 终止日期,酒店名称,sum(送货单总额) as 区间总额,入账日期 from 财务应收 where 日期 between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "'and 入账日期 is null and 送货数量 is not null group by 酒店名称,入账日期
与版主的大差不差!
呵呵谢谢
http://bbs.bccn.net/thread-332567-1-1.html
1