--看看这个可以吗?select * from 表 where A in (select B from 表 where A=5) and B=3

解决方案 »

  1.   

    --测试
    --创建表
    create table 表_test(id int,A int,B int)
    --插入数据
    insert 表_test
    select 1,     3,        9 
    union select 2,     5,        7 
    union select         3,     1,        4
    union select         4,     3,        6
    union select         5,     7,        3
    union select         6,     2,        7
    union select         7,     3,        3
    union select         8,     5,        9
    union select         9,     7,        3--查询
    select * from 表_test where A in 
        (select B from 表_test where A=5) and B=3
    --结果
    /*
    id          A           B           
    ----------- ----------- ----------- 
    5           7           3
    9           7           3(所影响的行数为 2 行)
    */
      

  2.   

    mschen(Visual【陈】) 的可以了