一个数据库查询语句错误,请帮忙看错误地点

来源:百度知道 编辑:UC知道 时间:2024/05/28 06:46:15
select inputer,count
from(
select inputer,count(1) count
from pe_soft
where channelid='2' and softid in (select * from pe_soft);
group by softid)
orde by count

select inputer,count
from (select inputer,count(*) count
from pe_soft
where channelid='2' and softid in (select softid from pe_soft))

group by inputer,count

orde by count

select inputer,count
from(
select inputer,count(*) count
from pe_soft
where channelid='2' and softid in (select softid from pe_soft);
group by softid,inputer)
orde by count
改了.你对比下
1 .count(1) ->count(*)
2 .* -> softid
3 .group by softid->group by softid,inputer

group by softid这句有错误,因为group by之后跟的字段必须是select之后跟的字段。在select inputer,count(1) count 后面加上softid应该就可以了。
select inputer,count
from(
select inputer,count(*) count,softid
from pe_soft
where channelid='2' and softid in (select * from pe_soft);
group by softid,inputer)
orde by count

andn改成or

第三行 count(1) 改成 count(*)