MySQL Forums
Forum List  »  Optimizer & Parser

Re: Query Optimization
Posted by: Anthony Willard
Date: August 28, 2006 07:33AM

You could generate your result into a temporary table that contained an autoincrement column, then use the MOD function (or the % operator) to select data with a value = 0.

Something similar to :

-- counter_id is an auto increment column.

select a.*
from mytable a
where a.counter_id % 19 = 0

That should get you every 19 row, or more precisely, every row where the counter id is an even multiple of 19.

You should be able to adapt this for getting your sample.

HTH

Anthony

Options: ReplyQuote


Subject
Views
Written By
Posted
2669
August 21, 2006 11:05AM
1692
August 21, 2006 06:44PM
1707
August 27, 2006 11:50PM
Re: Query Optimization
1823
August 28, 2006 07:33AM


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.