MySQL Forums
Forum List  »  Newbie

Re: Select every other record
Posted by: Ramalingam Chelliah
Date: August 25, 2004 06:48AM

Hi ,

You can use MOD function on integer field ...

If you have set up ID as integer field and if ID is your primary key ...
say in table table1

Then do like this to get ODD records....

mysql> SELECT * from table1
WHERE MOD(ID,2)=1;

for even MOD(ID,2) should be 0;

Hope this helps...

Regards,
Ram.


We Learn the Most When we have to Invent

Options: ReplyQuote


Subject
Written By
Posted
August 25, 2004 05:49AM
Re: Select every other record
August 25, 2004 06:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.