我自己试了有错误:select * from tbl_xxx where x=(select * from tbl_xxx where x='B')
如我写这样,在SQL查询分析器中提示:服务器: 消息 116,级别 16,状态 1,行 1
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。

解决方案 »

  1.   

    --LZ表达到底是要什么结果?
    Select X,Y from tbl where x='B'
      

  2.   

    搂主X=B 和 X=(select X=B)  这两者有什么区别么??????你要表达的是这个意思么?
      

  3.   

    select * from tbl_xxx where x=(select * from tbl_xxx where x='B')
    --改为
    select * from tbl_xxx where x in (select x from tbl_xxx where x='B')
    为什么要这样写?不和我上面写的一样,而且这种速度慢
      

  4.   

    select * from tbl_xxx where x=(select y from tbl_xxx where x='B')
    又提示:子查询返回的值多于一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。
      

  5.   

    select * from tbl_xxx where x in (select y from tbl_xxx where x='B')搞定了。谢谢各楼的。
      

  6.   

    按照你的说法
    你的问题应该是这样啊
    “我现在想搜索 X=(select Y WHERE  X=B) 的所有结果,求SQL语句。”