开发者

Why does my SQL query fail?

I'm using this to retrieve information from a database, the query always brings errors

This is my query:

SELECT * FROM users ORDER BY RAND() LIMIT '10'

It alw开发者_运维技巧ays brings up errors on either the ORDER BY RAND() or the LIMIT '10'.

Any reason why this is happening? Also is there any solutions to this?


Limit should be integer? 10 instead '10'.


SELECT *
FROM affiliate
ORDER BY RAND()
LIMIT 10 

Note there are no quotes around 10


The LIMIT parameter is a number, not a string:

SELECT * FROM users ORDER BY RAND() LIMIT 10

Whitout the quotes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜