NYCPHP Meetup

NYPHP.org

[nycphp-talk] every other record

Mark Armendariz enolists at gmail.com
Wed Feb 1 15:49:08 EST 2006


> Do you think it's reliable to mod() the record id to pull 
> every other record, like:
> 
> select * from table where mod(id,2)=0 #or select * from table 
> where mod(id,2)=1

It seems to me that it would be more efficient and 'correct' to query all
rows and output every other record in your php.  Considering that if a row
is removed, the break in your id's will make for an incorrect alternate
output and the mass list of selects seems rather inefficient.  Also ,that
would allow you to modify your query for other needs (orders, grouping, etc)
while still maintaining the alternate output.

(My apologies as I realize this doesn't answer your question, specifically)

Mark




More information about the talk mailing list