user1851919
user1851919

Reputation: 23

MySQL select from where clause on

I would like to select 10 rows from the where clause onward.

143 2017-03-14  07:02:02:693    1.21406 1.21426 02:674  00:019  7                           
144 2017-03-14  07:02:02:719    1.2141  1.2143  02:693  00:026  8                           
145 2017-03-14  07:02:02:752    1.21415 1.21424 02:719  00:033  9                           
146 2017-03-14  07:02:02:762    1.21414 1.21423 02:752  00:010  10  1.21619 1.21656 1.21658 1.21658 1.21657 1.21576 
147 2017-03-14  07:02:02:789    1.21413 1.21422 02:762  00:027  11  1.21619 1.21656 1.21658 1.21658 1.21657 1.21576 
148 2017-03-14  07:02:02:802    1.21408 1.21428 02:789  00:013  12  1.21619 1.21656 1.21658 1.21658 1.21657 1.21576 
149 2017-03-14  07:02:02:895    1.2141  1.2143  02:802  00:093  13  1.21619 1.21656 1.21658 1.21658 1.21657 1.21576 
150 2017-03-14  07:02:03:030    1.21409 1.21429 02:895  00:108  1                           
151 2017-03-14  07:02:03:237    1.2141  1.2143  03:03   00:234  2                           
152 2017-03-14  07:02:03:357    1.21411 1.21431 03:237  00:120  3                           
153 2017-03-14  07:02:03:484    1.21418 1.21438 03:357  00:127  4                           
154 2017-03-14  07:02:03:563    1.21415 1.21435 03:484  00:079  5                           
155 2017-03-14  07:02:03:676    1.21413 1.21433 03:563  00:113  6                           
156 2017-03-14  07:02:03:785    1.21411 1.21431 03:676  00:109  7                           
157 2017-03-14  07:02:03:908    1.21413 1.21433 03:785  00:123  8                           
158 2017-03-14  07:02:04:013    1.21415 1.21435 03:908  00:105  1                           
159 2017-03-14  07:02:04:131    1.21413 1.21433 04:013  00:118  2                           
160 2017-03-14  07:02:04:233    1.21415 1.21435 04:131  00:102  3                           
161 2017-03-14  07:02:04:518    1.21414 1.21434 04:233  00:285  4                           
162 2017-03-14  07:02:04:812    1.21416 1.21436 04:518  00:294  5                           

Like here, select the 9th columns first row which is not empty and then the following 10 rows including the empty 9 column rows.

How is possible to do this?

Thanks

Upvotes: 0

Views: 66

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269463

If you have a column that is often NULL and occasionally takes on values, you can get the next rows using:

select t.*
from t
where t.id >= (select min(t2.id) from t t2 where t2.col is not null)
order by id
limit 10;

Note: this assumes that "next" means the ones with the next highest ids.

Upvotes: 1

Related Questions