On 12 Apr 2018, at 5:16pm, R Smith <ryansmit...@gmail.com> wrote: > SELECT MIN(TheDate) -- get the smallest date > FROM Orak -- from the table with School-days > WHERE TheDate >= date('now') -- where the school-day is later or equal to > today. > ;
This reflects exactly the right structure for the data. The following may be a little faster: SELECT TheDate FROM Orak WHERE TheDate >= date('now') ORDER BY TheDate LIMIT 1 Both the above queries will perform far faster if there is an index on the "TheDate" column in Orak. I'm not quite sure how your data is organised but this may perform another job too if it is a UNIQUE index. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users