On 10/13/2014 5:21 PM, pihu...@free.fr wrote:
Do you know a simplest/better way to perform this query?

Something along these lines:

select * from ReportJobs r1
where rowid in (
  select r2.rowid from ReportJobs r2
  where substr(r2.GroupName, 1, 5) = substr(r1.GroupName, 1, 5)
    and r2.PlanDate = '2014-02-13'
order by (strftime('%s', r2.End) - strftime('%s', r2.Start)) desc limit 10
);

It'll probably be noticeably slower than your unrolled query, though.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to