<p>I have a MySQL table with approximately 3000 rows per user. One of the columns is a datetime field, which is mutable, so the rows aren't in chronological order.</p>

<p>I'd like to visualize the time distribution in a chart, so I need a number of individual datapoints. 20 datapoints would be enough.</p>

<p>I could do this:</p>

<pre><code>select timefield from entries where uid = ? order by timefield;
</code></pre>

<p>and look at every 150th row.</p>

<p>Or I could do 20 separate queries and use <code>limit 1</code> and <code>offset</code>. </p>

<p>But there must be a more efficient solution...</p>

Something like this came to my mind
```
```
select @rownum:=@rownum+1 rownum, entries.* 
from (select @rownum:=0) r, entries 
where uid = ? and rownum % 150 = 0
```
```
I don't have MySQL at my hand but maybe this will help ...