Hi,
I have the following query which pulls information from 3 tables:
SELECT b.*, p.amount_paid FROM tblBusinesses b tblPayments p WHERE p.business_id = b.business_id AND p.account_id = 1
The tblPayment table contains a combined primary key (business_id and account_id), and an amount_paid column. There will only ever be 1 entry in the tblPayment table for any business/account combination (this is for a learning program, not for actual business payments)
The result I'm trying to achieve is to output all businesses whether or not a payment has been made (ie, even if no entry exists in the tblPayment table for this business/account combination).
Can someone help me figure out this query (do I need an outer join for this?)
Thanks for any help
I have the following query which pulls information from 3 tables:
SELECT b.*, p.amount_paid FROM tblBusinesses b tblPayments p WHERE p.business_id = b.business_id AND p.account_id = 1
The tblPayment table contains a combined primary key (business_id and account_id), and an amount_paid column. There will only ever be 1 entry in the tblPayment table for any business/account combination (this is for a learning program, not for actual business payments)
The result I'm trying to achieve is to output all businesses whether or not a payment has been made (ie, even if no entry exists in the tblPayment table for this business/account combination).
Can someone help me figure out this query (do I need an outer join for this?)
Thanks for any help