asp net sql每一天一组查询循环代码 按天一组循环数据

 今天做网站,发现有个需求是,按天一组循环数据,思路如下:先查询 每天时间,并且去重复。然后带入每天日期如循环即可

如:

'查询日期去重复 日期就是当天格式。不能带分钟

Sqll="Select  distinct top 60 LastTime  From Guan_B_Info where cid=24 Order By LastTime Desc"

 

然后在带入日期去查询 ,循环。

Sql=" And Guan_B_Info.LastTime=#"&rsl("LastTime")&"#"

Sql="Select Guan_B_Info.IID,Guan_B_Info.SID,Guan_B_Info.CID,Guan_B_Info.OID,Guan_B_Info.LID,Guan_B_Info.SameContent,Guan_B_Sort.SameContent,Guan_B_Info.LastTime From Guan_B_Info,Guan_B_Sort Where Guan_B_Info.LID="&LID&" And Guan_B_Info.CID="&CID&" And Guan_B_Sort.SID=Guan_B_Info.SID"&Sql&" Order By Guan_B_Info.iid Desc"