Created
June 7, 2016 16:42
-
-
Save obedmhg/52513786858800ad40e2bf5ff020f5b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT product_id | |
FROM (SELECT product_id, MAX(sequence_num) AS "MAX_SEQ", count(*) -1 AS "COUNT" | |
FROM (SELECT DISTINCT dcc.product_id, dcc.sequence_num, dcc.sku_id | |
FROM dcs_product dc | |
INNER JOIN dcs_prd_chldsku dcc ON (dcc.product_id = dc.product_id) | |
WHERE dc.asset_version = dcc.asset_version | |
AND dc.is_head = 1 | |
) | |
GROUP BY product_id | |
) | |
WHERE max_seq <> count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment