当前位置:数据库 > MySQL >>

Mysql用sql语句进行查询的问题

Sql语句:SELECT * from (select l_id, l_auther, count(*) as num from t_load group by l_auther ORDER BY COUNT(*) DESC) limit 0,10 我想查询出现次数最多的前十条数据 各位大侠帮我看看这条语句错哪了,还是Mysql不支持这样查询 mysql报错:[Err] 1248 - Every derived table must have its own alias
追问:这个 t 是不是相当于定义一个虚拟表的名字?,谢谢,问题解决
答案:limit前面加上一个别名t就可以了

SELECT * from (select l_id, l_auther, count(*) as num from  t_load group by l_auther ORDER BY COUNT(*) DESC) t limit 0,10
其他:select  l_auther, count(*)  from  t_load group by l_auther ORDER BY 3 DESC limit 10

上一个:mysql更新
下一个:我已经安装好了mysql server 5.0,怎么用

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,