Sunday, 8 September 2013

Left outer join with extra conditions in django

Left outer join with extra conditions in django

I have problems to do this SQL with django queryset+Q objects.
How can I do that without raw query?
SELECT *
FROM Table1 T1
LEFT OUTER JOIN Table2 T2 ON T1.id == T2.fk_id AND (T2.VALUE = 'val1' OR
T2.VALUE IS NULL)

No comments:

Post a Comment