SELECT pid,cid,product_id,thickness FROM products WHERE thickness <> "";
SELECT cid,level,thickness FROM catalog WHERE thickness <> "";
所有pid都映射到cid。我只对2级映射感兴趣。
目标,我想知道哪些产品在目录,产品中的厚度值不同。请注意,产品通过cid附加到类别,所有产品都附加到2级类别。
答案 0 :(得分:1)
SELECT a.pid, a.product_ID
FROM products a
INNER JOIN catalog b
ON a.cid = b.cid AND
b.level = 2
WHERE a.thickness <> b.thickess