我被困在一个查询中。我不知道究竟是什么问题..任何 1 都可以帮助我吗?
这是代码:
当我运行查询时,它抛出错误:错误:关系“承包商”不存在第 5 行:来自“承包商”
select cont.name, cont.total,cp.contractor_id,cp.amount_paid,wt.id
FROM
(
select name,sum(amount_to_be_paid) as total
from "CONTRACTORS"
group by name
) cont
left join
(
select contractor_id,sum(amount_paid) as amount_paid
from "CONTRACTOR_PAYMENTS"
group by contractor_id
) cp
on cont.id= cp.contractor_id
left join worktypeids as wt on cont.worktypeid_id = wt.id AND wt.project_id=2