比如表A中
字段1 字段2
1 a
2 a
1 b
1 b
2 a
用sql语句实现查询,查询出
1 a
1 b
select distinct x.字段一,x.字段二
from a as x,a as y
where x.字段一=y.字段一 and x.字段二!=y.字段二
博客给出表A数据,包含字段1和字段2,有不同数值组合。要求用SQL语句从表A中查询出字段1为1,字段2分别为a和b的数据。
select distinct x.字段一,x.字段二
from a as x,a as y
where x.字段一=y.字段一 and x.字段二!=y.字段二