Select trim(WorkHistory.Employee) as Employee, trim(WorkHistory.accounts) as accounts,Badd.money1 as money1,Bdel.money2 as money2,trim(WorkHistory.affair) as affair From ((WorkHistory left join (Select id,Month_Price as money1 from WorkHistory where Month_Price>0  ) as Badd on WorkHistory.id= Badd.id)  left join (Select id,Month_Price as money2 from WorkHistory where Month_Price<0  ) as Bdel on WorkHistory.id= Bdel.id) Where   " & SelectWhere
看看这的写法是你所要的。

解决方案 »

  1.   

    select a.field1 as a,b.field2 as b from (select field1 from table1 where field1>=0) as a,(select field1 from table1 where field2<0) as b
    我没试,我的SQL SERVER坏了,不知道有没有错误,现在我只是不知道这两个表是如何连接的,但是我想我的思路可能会给您一些提示吧
      

  2.   

    好吧是这样的。
    1。在表中找出你>0的临时表
    (Select id,Month_Price as money1 from WorkHistory where Month_Price>0  ) as Badd 并与主表关联
    2.用同样的言式找出<0的临时表关与主表关联
    3。从两个临时表与主表中取出你要的字段就ok了
      

  3.   

    select a,(case  when b>=0 then b else Null end) as Positive,(case  when b<0 then b else Null end) as Negative from tblljj以上就把正數和負數分成了兩個字段顯示,這樣就可以正數字段關聯A列,負數字段關聯B列就可以了.
      

  4.   

    我刚在ACCESS中试是不行的,不知道在SQL SERVER中可不可以,你试一下吧,如果可以希望告诉我一声,谢谢
      

  5.   

    weiljj() 回答的正中题意,其他人的答案也帮我学到了新的知识,谢谢大家!
      

  6.   

    select (case a when a>0 then a else Null end) as colA,(case a when a<0 then a else Null end)
    as colB from TB