[nycphp-talk] Need help randomly accessing records from a database
Cliff Hirsch
cliff at pinestream.com
Thu Sep 1 09:25:59 EDT 2005
I need to randomly access records from a database and have come up with
the following solution:
1. Find max primary key id
2. Generate random # between 0 & max
3. Get record
This solution implies that the primary key value is 0...Max,
sequentially without "holes".
But what it I delete records or want to "mask out" certain records? If I
delete records, it's seems like the only method would be to reindex the
database. And to mask, I'm lost other than using a 2nd database
containing just the desired records with a join to the first.
Any ideas?
Cliff Hirsch
_______________________________
Pinestream Communications, Inc.
Publisher of Semiconductor Times & Telecom Trends
52 Pine Street, Weston, MA 02493 USA
Tel: 781.647.8800, Fax: 781.647.8825
http://www.pinestream.com
More information about the talk
mailing list