日期:2014-05-18  浏览次数:20552 次

请教!!!!!
有这样一个表
票号                 序号         档案号
0001                   1                   a
0001                   2                   a
0001                   3                   a
0001                   1                   b
0002                   1                   a
0003                   1                   a
0003                   2                   a
0004                   1                   a
0004                   1                   b
想查出档案号中一起出现过AB的票号

------解决方案--------------------
select distinct 票号 from 表 t where t.档案号= 'a ' and exists(select 1 from 表 where 票号=t.票号 and 档案号= 'b ')