cdl_9009 (10/18/2013)
I think this is close but still isn't working. It is saying no data found but i know there is.select VENDOR.vendor_name, (ORDERS.ORD_TOTAL_COST + Orders.ord_total_cost)as "Total Amount Owed"
from VENDOR JOIN ORDERS ON
ORDERS.VENDOR_ID = VENDOR.VENDOR_ID
JOIN ACCOUNT_PAYABLE ON
ACCOUNT_PAYABLE.ORD_ID = ORDERS.ORD_ID
WHERE ACCOUNT_PAYABLE.ORD_ID NOT IN ( SELECT ORDERS.ORD_ID
FROM ORDERS
WHERE ORDERS.ORD_ID = ACCOUNT_PAYABLE.ORD_ID );
Didn't feel like creating the DDL for your tables or the scripts to populate them, so you will have to tell me if this works or not:
select
v.vendor_name,
o.total_price
from
Vendor v
inner join Order o
on (v.vendor_id = o.vendor_id)
where
not exists(select 1 from account_payable ap where ap.ord_id = o.ord_id);