请看一下下面这个语句是否是你要的?
select *
from table
where hykh,bbrq in (
select hykh,bbrq
from table
where yjje in (5,-5)
group by hykh,bbrq having count(distinct yjje)=2 and count(yjje)=2
)
收起那其实就用你需要的这两个列作为条件不就可以了吗
select a.* from test a, test b where a.hykh=b.hykh and a.bbrq=b.bbrq
order by ...........
应该有更简单的sql写法,暂时想不来了,给你一个比较笨重的sql先试一试吧
收起