Hi, Am starting to teach myself SQL. I cannot figure out how to do the most simple of queries, and it is driving me nuts. Here's the basic scenario:
Table: Customer
custid
firstname
lastname
Table: Transactions
custid
transdate
transamount
I want a query which will display ALL customers and any associated transactions. However, the query I used (below) only returns the customer if there is a transaction for it. For customers with no transactions, they are not being listed and I need help to show me how to structure the query to that the listing of the master table is not dependent on there being any child records in existence.
[code=sql]select customer.custid , customer.firstn ame, customer.lastna me, transactions.tr ansdate, transactions.tr ansamount
from customer, transactions where customer.custid =transactions.c ustid[/code]
Please tell me where I am going wrong!!!
Table: Customer
custid
firstname
lastname
Table: Transactions
custid
transdate
transamount
I want a query which will display ALL customers and any associated transactions. However, the query I used (below) only returns the customer if there is a transaction for it. For customers with no transactions, they are not being listed and I need help to show me how to structure the query to that the listing of the master table is not dependent on there being any child records in existence.
[code=sql]select customer.custid , customer.firstn ame, customer.lastna me, transactions.tr ansdate, transactions.tr ansamount
from customer, transactions where customer.custid =transactions.c ustid[/code]
Please tell me where I am going wrong!!!
Comment