15 lines
623 B
SQL
15 lines
623 B
SQL
|
|
USE [Database]
|
||
|
|
|
||
|
|
SELECT [E].[id], [E].[name], [T].[name], [A].[attribute_id], [AN].[name], [V].[value]
|
||
|
|
FROM [Tables].[products] AS [E]
|
||
|
|
JOIN [Tables].[product_types] AS [T]
|
||
|
|
ON [T].[id] = [E].[product_type_id]
|
||
|
|
JOIN [Tables].[product_attributes] AS [A]
|
||
|
|
ON [A].[product_id] = [E].[id]
|
||
|
|
JOIN [Tables].[attributes] AS [AN]
|
||
|
|
ON [AN].[id] = [A].attribute_id
|
||
|
|
LEFT JOIN [Tables].[product_values] AS [V]
|
||
|
|
ON [V].[product_id] = [A].[product_id]
|
||
|
|
AND [V].[attribute_id] = [A].[attribute_id]
|
||
|
|
|
||
|
|
EXECUTE [Procedures].[select_expired_products] @date_of_manufacture_attribute_id, @expiration_date_attribute_id, N'19000201'
|