【发布时间】:2021-11-14 23:33:09
【问题描述】:
我用 2 个本机查询来解决这个任务,但想用一个本机查询来解决这个问题,如果可能的话,你能告诉我方法吗。
这是我的第一个查询:
select o.id as id,o.date as date,o.customer_id_id as customerId
from orders o left outer join
invoice i
on o.id = i.order_id_id
where i.order_id_id is null
intersect
select o.id as id,o.date as date,o.customer_id_id as customerId
from detail d join
orders o
on o.id = d.order_id_id
这是我的第二个查询,我从第一个查询中使用 o.id,它的意思是 ?1=o.id:
select sum(d.quantity*p.price)
from product p join
detail d
on p.id=d.product_id_id
where d.order_id_id=?1
这是项目的 grafic enter image description here
任务文本:对于每个没有发票的订单,列出其 ID、下达日期和总价 产品详细信息,考虑到每个订购产品的数量及其单位 价钱。没有详细信息的订单不得包含在答案中。
【问题讨论】:
标签: java postgresql spring-boot