MySQL Forums
Forum List  »  General

Re: Is "LIMIT $n,1 MOD $m" possible in mysql?
Posted by: Markus M.
Date: May 27, 2015 10:39PM

ps: It's not $m, actually I meant the number of rows of the table.

But I don't know about those combined statements, I would just do a COUNT on that table, store the number of rows in $m.

Then PHP would do the $n % $m, and in the next mysql statement that $n would be used.

So there's possibilty for a race condition, some admin removing rows from the table just when PHP does the $n % $m. That's why I thought using only one sql statement would be the best.

"LIMIT 344436,1 MOD COUNT(*)" or "PICK ROW 344436, GIVE ME DEFINATELY A ROW, WRAP AROUND, ROUND ROBIN" .. anything like this.

Ok enough, sorry :)
I'm new to Mysql. Should post into the newbies forum probably.
Kind regards,
Markus

Options: ReplyQuote


Subject
Written By
Posted
Re: Is "LIMIT $n,1 MOD $m" possible in mysql?
May 27, 2015 10:39PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.