select  (
  select A,B
  from table_a
  where condition_a
 )
,
 (
  select C,D
  from table_a
  where condition_b
 )
from table_a
where condition_a and condition_b非常感谢

解决方案 »

  1.   

    这个语句在Oracle可能是正确的,但是在SQL Server中不符合语法规则。子查询只能返回一个字段列表。
      

  2.   

    括号里的东西是select子查询,子查询可以起个别名后被from子句引用.
    如果select子查询只返回一列的话,也可以被 in,not in 引用.
    单是子查询放到select后面,是错误的写法.
      

  3.   

    更正,子查询被select 引用时
    select (select top 1 a from t_a),...
    这样是可以的
    select (select a from t_a) ,...
    如上,只引用一列但不唯一,也是不可以的.
      

  4.   

    select (select a from t_a where t_a.id = t_b.id),t_b.col from t_b
    这样是可以的.