I need help with the following query. I have two tables:
1) ORDERS(columns: fileid(pk), status, office, other fields)
2) INVOICES(columns: invoiceid(pk), fileid, status, date, amount, other fields)
I can have multiple invoices for an order.
I would like to select all the orders that match a certain condition and include a column in the results that tell if an invoice that meets certain conditions exsists for that record.
I have the following query for the ORDERS table:
Select fileid, office from ORDERS where status = 'closed' and office = 'New York'
The condition I need for my INVOICE table is: status = 'closed'
I am lost as how to do this, I don't know if I should use a CASE statement, use Exsists, subquery...
Any help that can be provided is appreciated.
1) ORDERS(columns: fileid(pk), status, office, other fields)
2) INVOICES(columns: invoiceid(pk), fileid, status, date, amount, other fields)
I can have multiple invoices for an order.
I would like to select all the orders that match a certain condition and include a column in the results that tell if an invoice that meets certain conditions exsists for that record.
I have the following query for the ORDERS table:
Select fileid, office from ORDERS where status = 'closed' and office = 'New York'
The condition I need for my INVOICE table is: status = 'closed'
I am lost as how to do this, I don't know if I should use a CASE statement, use Exsists, subquery...
Any help that can be provided is appreciated.