关于数据库查询问题!
数据表如下 :
cid,hid,eid,fc[都是数字型],intime[时间]
现在我想根据传递过来的开始时间与结束时间[inTime between # "&ExlBTime& "# and # "&ExlETime& "#]对cid进行分组统计fc的值,同时要显示cid,hid,eid,fc,intime的,请问该怎么弄!
比如:
cid hid eid fc intime
1 1 2 4.5 2007-08-05
2 1 1 10.2 2007-08-05
1 1 2 11 2007-08-05
1 1 2 5.0 2007-08-06
如果传递过来的开始时间为2007-08-01,结束时间为2007-08-05
想统计显示的结果为:
cid hid eid fc intime
1 1 2 15.5 2007-08-05
2 1 1 10.2 2007-08-05
------解决方案--------------------select cid,hid,sum(eid) as eid,fc,intime form 表 where inTime between # "&ExlBTime& "# and # "&ExlETime& "#
试试
------解决方案--------------------在后面加上 group by cid 来试试.