package queries

const GetProductSecondColors = `
SELECT
	Product.ProductCode,
	ISNULL(prItemVariant.ColorCode, '') AS ColorCode,
	ISNULL(prItemVariant.ItemDim2Code, '') AS ItemDim2Code,
	ISNULL(ColorDesc.ColorDescription, '') AS ColorDescription
FROM prItemVariant
	INNER JOIN ProductFilterWithDescription('TR') AS Product
		ON prItemVariant.ItemCode = Product.ProductCode
	LEFT JOIN cdColorDesc AS ColorDesc
		ON ColorDesc.ColorCode = prItemVariant.ItemDim2Code
		AND ColorDesc.LangCode = 'TR'
WHERE Product.ProductCode = @ProductCode
  AND prItemVariant.ColorCode = @ColorCode
  AND ISNULL(prItemVariant.ItemDim2Code, '') <> ''
GROUP BY
	Product.ProductCode,
	prItemVariant.ItemDim2Code,
	prItemVariant.ColorCode,
	ColorDesc.ColorDescription
ORDER BY ItemDim2Code
`
