PDA

View Full Version : limit error


santaclaus
11-19-2009, 09:28 PM
Somehow there is something wrong with my sql statement below. But I can't figure it out :S

It works fine without LIMIT 16, but I need to retrieve 16 records.


SELECT * FROM myshop LIMIT 16 where article='' ORDER BY RAND()

djm0219
11-19-2009, 09:37 PM
The limit needs to be after your order by

SELECT * FROM myshop where article='' ORDER BY RAND() LIMIT 16