使用limit时,sql查询返回错误

时间:2010-08-14 17:41:56

标签: php sql mysql

为什么这个查询有效?我该怎么写呢?

select * from tbl_content order by year desc where visible = '1' limit 0,30;

1 个答案:

答案 0 :(得分:3)

WHERE子句在ORDER BY之前。

重写为:

select * from tbl_content where visible = '1'  order by year desc limit 0,30;