Distribution of table in time
I have a MySQL table with about 3000 rows per customer. Among the columns is a datetime area, which is mutable, so the rows aren't in sequential order.
I would certainly such as to envision the moment circulation in a graph, so I require a variety of specific datapoints. 20 datapoints would certainly suffice.
I can do this:
select timefield from entries where uid = ? order by timefield;
and also consider every 150th row.
Or I can do 20 different questions and also make use of
limit 1 and also
Yet there have to be an extra reliable remedy ...
For whatever factor, your instance just functions when the where @recnum makes use of a much less than driver. I assume when the where remove a row, the rownum does not get incremented, and also it can not match anything else.
If the initial table has a vehicle incremented id column, and also rows were put in sequential order, after that this need to function:
select timefield from entries where uid = ? and id % 150 = 0 order by timefield;
Of training course that does not function if there is no relationship in between the id and also the timefield, unless you do not in fact respect obtaining equally spaced timefields, simply 20 arbitrary ones.