SQL中CONVERT函数的问题

发布网友 发布时间: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

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com