oderID color
1 红色
1 黄色
2 红色
2 绿色
3 黄色
3 绿色
4 红色
4 黄色
查询color既有红色又有黄色的oderID
结果为 1
4 这个怎么写 各位大神
求助:某个字段内两个条件都满足的情况怎么写,新手上路,求扶
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
5条回答 默认 最新
Zacharl 2019-08-12 15:51关注select orderid,color from table t1 where t1.color='红色' and exists (select 1 from table t2 where t2.color='黄色' and t1.orderid=t2.orderid);
解决 无用评论 打赏 举报