16 lines
559 B
Transact-SQL
16 lines
559 B
Transact-SQL
|
|
USE [Database]
|
||
|
|
|
||
|
|
IF OBJECT_ID('[Procedures].[product-properties]', 'P') IS NOT NULL
|
||
|
|
DROP PROCEDURE [Procedures].[product-properties];
|
||
|
|
GO
|
||
|
|
CREATE PROCEDURE [Procedures].[product-properties]
|
||
|
|
@product_id AS INT
|
||
|
|
AS
|
||
|
|
SELECT [A].[id], [A].[name], [PV].[value]
|
||
|
|
FROM [Tables].[product_attributes] AS [PA]
|
||
|
|
LEFT OUTER JOIN [Tables].[product_values] AS [PV]
|
||
|
|
ON [PV].[product_id] = [PA].[product_id]
|
||
|
|
AND [PV].[attribute_id] = [PA].[attribute_id]
|
||
|
|
JOIN [Tables].[attributes] AS [A]
|
||
|
|
ON [A].[id] = [PA].[attribute_id]
|
||
|
|
WHERE [PA].[product_id] = @product_id;
|