 <p>I solved it! This is the query:</p> <pre><code>select case when (select min(time(myColumn)) from myTable where time(current_timestamp, 'localtime') &lt; time(myColumn)) is null then (select min(time(myColumn)) from myTable where time(current_timestamp, 'localtime') &gt; time(myColumn)) else (select min(time(myColumn)) from myTable where time(current_timestamp, 'localtime') &lt; time(myColumn)) end </code></pre> <p>Thx Tim &amp; Dave who showed me the way.</p>