I have two tables.
Transaction
------------
TransactionId
Date
Amount
Quantity
ProductCode
etc
-and-
Product
-----------
ProductId
Description
ProductCode
etc
I am trying to create a stored procedure that will give me the transactions with the description of the product with them.
I have this so far but it’s not even close to compiling. I’m not understanding SQL syntax to well.
USE SuburbanPortal;
SELECT [CompanyCode]
,[Status]
,[Branch]
,[ProductCode]
,[TransactionBranch]
,[AccountNumber]
,[ReferenceNumber]
,[TransactionDate]
,[Quantity]
,[Amount]
,[SalesTax]
FROM [Company].[Transaction]
LEFT OUTER JOIN [Company].[Transaction] ON
[Company].[Transaction].[ProductCode] = [Company].[Products].[ProductCode]
Can someone point me in the right direction?
Why aren’t you using an
INNER JOIN? Also, you’re joining[Transaction]on[Transaction]instead of[Transaction]on[Product].