from table1 as a,table1 as b where a.tCode = b.sCode and (a.tCode ='1000' or a.tCode='1002')

解决方案 »

  1.   

    2楼你怎么不直接select * from table1 where id='1' or id ='2'
      

  2.   

    呵呵,这个查询条件有点麻烦哦,而且你还要符合条件的值在其中一个表的一个字段中有两个(汗...),
    分两步吧,
    1.先想办法把sCode中有重复值的元组找到吧
    2.在根据得到的值在tCode中找,看能否找到,如果找到,则你要的结果出来了
    也可以把1.2颠倒,
    先在两表中找相等的,再把得到的值在sCode中找下有没有重复,
    OK
    =====蜗牛小屋http://www.pjwqh.cn====
      

  3.   

    问题解决了欢迎到http://www.pjwqh.cn/message/index.jsp告诉我你的解决办法^_^
      

  4.   

    去看看你自己的这个帖子,我给你回复过了http://topic.csdn.net/u/20080806/16/621b7bb3-12a7-4d4f-9f40-751d433f62d5.html还是分享下吧:select count(*),tCode,sCode from table1 group by tCode,sCode having count(*) > 1 
      

  5.   

    select * from table1 a where a.tCode  in(select sCode  from tab1)
      

  6.   

    ......
    sCode要有重复且tCOde=sCodeselect t.* from table1 t,(select sCode,count(*) total from table1 group by sCode)temp where t.tCode = t.sCode and t.sCode = temp.sCode and temp.total >= 2