On 10 Apr 2015, at 2:24pm, Hamish Symington <info at hamishsymington.com> wrote:
> LEFT JOIN Appointment ON Appointment_TxnUUID=Txn_UUID > WHERE ( date( Appointment_StartDate ) >= trim( ? ) AND date( > Appointment_StartDate ) <= trim( ? ) ) ) The application of a function to the column values means that it is not possible for the optimiser to penetrate this WHERE clause and work out a good strategy. Try to change this to WHERE Appointment_StartDate BETWEEN ? AND ? by converting the parameters you bind in to text, rather than by asking SQLite to convert every value in the column to a date. This isn't the only thing that's causing a problem, but it might be the easiest to fix. Simon.

