I have this SQL in Postgres and it works fine, I'm trying to port it
over to SQLite and having issues.. SQLite doesnt like left outer
joining to a subquery..
Can you guys think of a way around this?

select b.amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note,
b.payeeid, case when p.amount is null then 0 else sum(p.amount) end as
amount, payments,
case when p.amount is null then 0 else 1 end as paid, paiddate,
b.iscc, b.isactive
from bills b left outer join
(
        select p.payeeid, sum(p.amount) as amount, max(paiddate) as paiddate,
count(*) as payments, p.note
        from payments p
        where strftime("%m-%Y",paiddate) = '07-2008'
        group by p.payeeid, p.note
) p on p.payeeid = b.payeeid
group by amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note,
b.payeeid, p.amount, p.paiddate,p.payments, b.iscc, b.isactive

The subquery is used to get the null values so I can check to see if a
bill is paid..

Ideas?

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

Reply via email to