This is probably easy to do

Tsango

Registered User.
Local time
Today, 23:08
Joined
Mar 31, 2006
Messages
64
As I am an SQL novice I need some help

I have 3 tables

Table - Fields
SalesLedger - TransactionID, ProductID
Vouchers - TransactionID, Voucher_Ref
Products - ProductID, Product_Description

The Salesledger has fields TransactionID and ProductID

The Salesledger is linked to the Products table by the ProductID field

The SalesLedger is linked to the Voucher Table by the TransactionID field

How do I produce a query to list all the items in the Salesledger but if there is a Product in the Products Table matching the ProductID the Product details, and if there is a TransactronID in the Voucher Table list the VoucherRef.

At the moment, it only shows transactions if there is a corrosponding TransactionID in the Vouchers Table

Probably not explaned this at all well. I will try to elborate if required.
Edit/Delete Message
 
SalesLedger - TransactionID, ProductID
Vouchers - TransactionID, Voucher_Ref
Products - ProductID, Product_Description


In your query change the join types to option 2
 
Smart said:
SalesLedger - TransactionID, ProductID
Vouchers - TransactionID, Voucher_Ref
Products - ProductID, Product_Description


In your query change the join types to option 2

I was thinking that maybe I need to use a LEFT join

Is this what you are sufggesting???

Will give your suggestion a go now - Thanks.
 
Smart said:
SalesLedger - TransactionID, ProductID
Vouchers - TransactionID, Voucher_Ref
Products - ProductID, Product_Description


In your query change the join types to option 2

Top man!! That works now.

Still got so much to learn.....!!!

Thanks

Oliver
 

Users who are viewing this thread

Back
Top Bottom