如何使左外部联接子查询?

时间:2020-06-30 14:26:34

标签: django

SQL查询

select *
from products_product
         left join (
    select *
    from products_purchase
             join products_product on products_purchase.product_id = products_product.name
    where user_id = 1
) t on t.name = products_product.name
where products_product.name like '03%';

我想在Django orm上编写此查询,并使用user_id Null检查是否存在行。

0 个答案:

没有答案