SQL语句问题

wzllin 2006-07-31 11:31:24
select name1,country,age from person order by a compute sum(age),max(age),min(age) by country
...全文
135 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzllin 2006-08-02
  • 打赏
  • 举报
回复
请大家注意“compute ”词
kangji 2006-08-02
  • 打赏
  • 举报
回复
select name1,country,age, sum(age), max(age), min(age)
from person
group by age
order by contry
chen7872 2006-08-02
  • 打赏
  • 举报
回复
不明白,你能不能说明你要实现的结果
xiaosl0817 2006-08-02
  • 打赏
  • 举报
回复
我汗。。LZ的语法错的好厉害,1楼说的对,
而且,头次看见这样写的
select name1,country,age from person order by a compute sum(age),max(age),min(age) by country
要写也是
select name1,country,age,sum(age) a,max(age) b,min(age) c from person
然后再加上group by name1,country,age
最后才是order by

ShyHat 2006-08-01
  • 打赏
  • 举报
回复
SQL中一旦用了聚合函数,除 order by的字段外,其他字段都必须用聚合函数来写
wxch 2006-08-01
  • 打赏
  • 举报
回复
一楼说的正确。
柯本 2006-07-31
  • 打赏
  • 举报
回复
这是最基本的错误,SQL的聚合函数,前面的字段必须放入group by 中,且聚合函数必须在from的前面,如:
select country , sum(age),max(age),min(age) from person group by country


wzllin 2006-07-31
  • 打赏
  • 举报
回复
井低之蛙;

13,874

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧