发布网友 发布时间:2022-04-25 03:40
共3个回答
热心网友 时间:2022-04-11 19:25
因为select比group by要执行的晚,所以group by 里面不能用select 子句里面的别名:
select sum(fare) as fare,count(fare) as count,convert(varchar,tdatetime,102) as date
from em_recbuf
where posno = 243 and tdatetime between '2010-01-01' and '2010-01-31'
group by convert(varchar,tdatetime,102)
热心网友 时间:2022-04-11 20:43
把 group by date
换成group by tdatetime,你再试试
热心网友 时间:2022-04-11 22:18
select sum(fare) as fare,count(fare) as count,convert(varchar,tdatetime,102) as date from em_recbuf
where posno = 243 and tdatetime between '2010-01-01' and '2010-01-31' group by tdatetime