任何想法为什么这不起作用(基于你在论坛上的例子它应该!)谢谢。
select result.low
from (
select top 1 country as low, count()
from customers c, orders o
where c.customerid=o.customerid
group by country
order by count()
) as result
答案 0 :(得分:0)
如前所述,存在几个问题
select result.low
from (
select top 1 country as low, count() -- count() needs an argument and needs to be aliased
from customers c, orders o -- old style join
where c.customerid=o.customerid
group by country -- column `country` may need qualifying
order by count() -- count() needs an argument
) as result
所以查询应该是
select top 1 country as low
from customers c
join orders o
on c.customerid=o.customerid
group by c.country
order by count(*)