标签:
故事是这样的…..
故事情节: 表 tb_test 有两列, colA , colB; 求 colA , colB 的并交差集…
-- 计算并集
SELECT DISTINCT colB FROM tb_test
UNION
SELECT DISTINCT colA FROM tb_test
-- 计算交集
SELECT DISTINCT colB FROM tb_test
INTERSECT
SELECT DISTINCT colA FROM tb_test
-- 计算差集
SELECT DISTINCT colB FROM tb_test
EXCEPT
SELECT DISTINCT colA FROM tb_test
标签:
原文地址:http://www.cnblogs.com/BigBigLiang/p/4832613.html