Advertisement
Guest User

XML

a guest
Mar 1st, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.84 KB | None | 0 0
  1. SELECT 'Client Name' = p.personFirstName + ' ' + p.personLastName,
  2.        'State' = p.personState,
  3.        'Transaction Date' = CPT.transactionDate,
  4.        'Product Quantity' = CPP.productQuantity,
  5.        'Product Amount'  = pp.productAmount,
  6.        'Product Type' = PR.productType,
  7.        'Product Description' = Pr.productDescription
  8. FROM dbo.tblPeople AS P INNER JOIN dbo.tblClients AS C
  9.     ON c.client = p.personID
  10. INNER JOIN dbo.tblClientPurchaseTransactions AS CPT
  11.     ON CPT.client = C.client
  12. INNER JOIN dbo.tblClientPurchaseProducts AS CPP
  13.     ON CPP.transactionNumber = CPT.transactionNumber
  14. INNER JOIN dbo.tblProductPrices AS PP
  15.     ON PP.productItem = CPP.product AND PP.priceValidDate = CPP.productPriceDate
  16. INNER JOIN dbo.tblProducts AS PR
  17.     ON PR.productID = PP.productItem
  18. WHERE (PP.productAmount BETWEEN 25 AND 50) AND (C.activeClient = 1)
  19. FOR XML AUTO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement