NYCPHP Meetup

NYPHP.org

[nycphp-talk] every other record

Chris Merlo chris at theyellowbox.com
Wed Feb 1 17:12:33 EST 2006


On 2/1/06, Craig Thomas <craig at juxtadigital.com> wrote:

> In response to some others: just because ID 4 is missing [for example]
> doesn't mean ID 5 will have a remainder of 0 when divided by 2...he'll
> still get only even IDs with this:
>
> select * from table where mod(id,2)=0


You're right, my bad.  But it will still return the records with IDs 2, 6,
8, 10, etc., which is not every other record.  (That would be 2, 5, 7, 9,
etc.)

I'm not trying to suggest that solving this problem by getting every record
and letting PHP select every other one is more efficient; I'm merely
suggesting that it's more correct.  :)

--
chris at theyellowbox.com
http://www.theyellowbox.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060201/1d03ec63/attachment.html>


More information about the talk mailing list