Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-18-2012, 11:54 PM   PM User | #16
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,556
Thanks: 62
Thanked 4,055 Times in 4,024 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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 % 1000 or 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.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:05 AM.


Advertisement
Log in to turn off these ads.