Hello - i have following 3 tables:
tbl_Rating
tbl_Sold
tbl_Product
SO far i have the follwoing query:
I need to query modified to show the following results:
Any help is appreciated.
Thanks.
tbl_Rating
Code:
ID ProductNumber Rating
1 C_10, C_11 5
1 C_10, C_11 4.5
3 F_12 2
4 CH_3 3
Code:
ID ProductName Dealer ProductSOld
1 Chevy Cruise Sam 2
3 Fiat Compact Darcy 1
4 Chysler Van Donny 1
Code:
ID Brand
1 Chevy
2 GM
3 Fiat
4 Chysler
SO far i have the follwoing query:
Code:
Select S.ID, S.Dealer, P.Brand, R.ProductNumber,
( SELECT R.Rating + ', '
FROM tbl_Rating R
WHERE R.ID = S.ID
ORDER BY R.Rating
FOR XML PATH('') ) AS Rating2
FROM tbl_Sold S
LEFT JOIN tbl_Product P ON P.ID = S.ID
LEFT JOIN tbl_Rating R ON R.ID = S.ID
WHERE S.ProductSOld IS NOT NULL
GROUP BY S.ID, S.Dealer, P.Brand, R.ProductNumber, R.Rating
ORDER BY S.ID
Code:
ID Dealer Brand ProductNumber Rating
1 Sam Chevy C_10, C_11 5, 4.5,
1 Sam Chevy C_10, C_11 5, 4.5,
3 Darcy Fiat F_12 2
4 Donny Chysler CH_3 3
I need to query modified to show the following results:
Code:
ID Dealer Brand ProductNumber Rating
1 Sam Chevy C_10, C_11 5, 4.5
3 Darcy Fiat F_12 2
4 Donny Chysler CH_3 3
Any help is appreciated.
Thanks.