CaptainChainsaw Posted August 28, 2008 Share Posted August 28, 2008 Hi all, I've got an irratating SQL problem, the following SQL returns 9 rows: SELECT comments.id, comments.comment, users.username FROM comments, movies, users WHERE movies.id=comments.mid AND users.id=comments.uid AND movies.id=10 ORDER BY id DESC LIMIT 6, 9 However the same SQL with the LIMIT clause changed CORRECTLY returns 3 rows: SELECT comments.id, comments.comment, users.username FROM comments, movies, users WHERE movies.id=comments.mid AND users.id=comments.uid AND movies.id=10 ORDER BY id DESC LIMIT 0, 3 Anyone any ideas on this one? Thanks again, CC Link to comment https://forums.phpfreaks.com/topic/121779-solved-sql-problem/ Share on other sites More sharing options...
akitchin Posted August 28, 2008 Share Posted August 28, 2008 the first number is the offset, the second number is the length it should go for. try this: LIMIT 6, 3 i made that mistake when i was first learning too. the two numbers aren't start/stop offsets. have a peek in the MySQL manual for more details. Link to comment https://forums.phpfreaks.com/topic/121779-solved-sql-problem/#findComment-628278 Share on other sites More sharing options...
CaptainChainsaw Posted August 28, 2008 Author Share Posted August 28, 2008 Got it fixed now, thank you. Luckily it wasn't too much of a problem. Link to comment https://forums.phpfreaks.com/topic/121779-solved-sql-problem/#findComment-628288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.