我在配置单元中有以下数据:
userid cityid
1 15
2 15
1 7
3 15
2 8
3 9
3 7
我只想保留具有 cityid 15 和 cityid 7 的用户 ID(在我的示例中,它将是用户 ID 1 和 3)。
我试过:
select userid from table where cityid = 15 and userid in (select userid from table where cityid = 7);
但对于蜂巢来说,它不起作用。
有人可以帮忙吗?
Thanks!
好的,我找到了该怎么做:
select a.userid from (select userid from table where cityid = 15) a join (select userid from table where cityid = 7) b on a.userid = b.userid;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)