Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 16 to 16 of 16
07-18-2012, 11:54 PM #16
Well, if you truly will never have any more records, then what the heck. Use the answer in my post #14. You obviously have an unusual situation, what with having a fixed number of records.
I fully admit my advice in the prior posts was generic in nature. For the more common problem of databases that inevitably grow in time.
And note that
FLOOR(id/1000)will always get you back the original table number (1 through 20), so that's always available to your code, as well.
If you didn't know, the % operator is the MODULO operator: It gives you the remainder you get when you divide the left side value by the right side value. MySQL also has a MOD() function. So you can use either
id % 1000or
MOD( id, 1000 ), whichever you feel more comfortable with.An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.