This is my query:
SELECT f.FieldID,fd.FieldName, p.ProductID,pd.ProductName, p.Price,p.Stoc, p.IsActive,TextValue
FROM products_products p
LEFT OUTER JOIN products_products_details pd
on pd.ProductID = p.ProductID
LEFT OUTER JOIN fld_chosenvalues f
on f.ProductID = p.ProductID
INNER JOIN fld_fields_details fd
ON f.FieldID = fd.FieldID
WHERE pd.Locale = "ro-RO" and fd.Locale = "ro-RO"
In the image below , you can see the result of the query :
The problem is that I want to put the "Volum", the "Tip inchidere", the "Amabalare paiet", the "Ambalare bax" as a column and assign it the value "212ml"... you can see in the image below what exactly i want :
I apologize for the images, but I didnt know any other ways to explain that. Thx
This is the query with pivot, obviously is not working :
SELECT f.FieldID,fd.FieldName, p.ProductID,pd.ProductName, p.Price,p.Stoc, p.IsActive,TextValue
FROM products_products p
LEFT OUTER JOIN products_products_details pd
on pd.ProductID = p.ProductID
LEFT OUTER JOIN fld_chosenvalues f
on f.ProductID = p.ProductID
INNER JOIN fld_fields_details fd
ON f.FieldID = fd.FIeldID
PIVOT
(
FOR [f.FieldName] IN (['Volum'], ['Tip inchidere'], ['Amabalare palet'], ['Ambalare bax'])
) as pvt;
WHERE pd.Locale = "ro-RO" and fd.Locale = "ro-RO"