SQLite Forum

Can this SQL be simplified?
Login
Hello Tim !

select id
from T2,
    (select count(*) cnt from T2) t2_cnt,
    (select maxrows from T1) max_t1
order by mydate
limit case when t2_cnt.cnt > max_t1.maxrows
    then t2_cnt.cnt - max_t1.maxrows
    else 0 end;
 
Cheers !