sql 如何比较一个结果集在另一个结果集中存在
Select distinct GPLD_Group from V_AllUsers where GPLD_User in('grinm\ly','grinm\liuhz','grinm\lisl')Select distinct GPLD_Group from V_AllUsers where GPLD_User='grinm\huangzh'
SELECT CASE WHEN COUNT(1) > 0 THEN 0 ELSE 1 END FROM ( SELECT DISTINCT GPLD_Group FROM V_AllUsers WHERE GPLD_User IN ( 'grinm\ly', 'grinm\liuhz', 'grinm\lisl' ) EXCEPT SELECT DISTINCT GPLD_Group FROM V_AllUsers WHERE GPLD_User = 'grinm\huangzh' ) a
[解决办法]
小的
except
大的
得到空,说明大的完全包含小的