Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- SaleTbl.id as 'sale number',
- STRING_AGG
- (
- CONCAT
- (
- ProductTbl.name,' x',cast(SoldProductsTbl.quantitySold as nvarchar)
- ),','+ char(13)+char(10)
- ) AS 'sold products'
- FROM
- SoldProductsTbl
- JOIN
- ProductTbl on SoldProductsTbl.productID = ProductTbl.id
- JOIN
- SaleTbl on SoldProductsTbl.saleID = SaleTbl.id
- GROUP BY SaleTbl.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement