Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT 'Client Name' = p.personFirstName + ' ' + p.personLastName,
- 'State' = p.personState,
- 'Transaction Date' = CPT.transactionDate,
- 'Product Quantity' = CPP.productQuantity,
- 'Product Amount' = pp.productAmount,
- 'Product Type' = PR.productType,
- 'Product Description' = Pr.productDescription
- FROM dbo.tblPeople AS P INNER JOIN dbo.tblClients AS C
- ON c.client = p.personID
- INNER JOIN dbo.tblClientPurchaseTransactions AS CPT
- ON CPT.client = C.client
- INNER JOIN dbo.tblClientPurchaseProducts AS CPP
- ON CPP.transactionNumber = CPT.transactionNumber
- INNER JOIN dbo.tblProductPrices AS PP
- ON PP.productItem = CPP.product AND PP.priceValidDate = CPP.productPriceDate
- INNER JOIN dbo.tblProducts AS PR
- ON PR.productID = PP.productItem
- WHERE (PP.productAmount BETWEEN 25 AND 50) AND (C.activeClient = 1)
- FOR XML AUTO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement