| 发表于:2007-12-13 16:53:325楼 得分:0 |
with temp(money_type,money) as (select money_type,local_money money from test13 where money_type <> '001' union all select money_type, case when money_type ='001' then local_money else foreign_money end money from test13) select case when money in(select local_money from test13 where money_type <> '001') then '001' else money_type end, money from(select * from temp order by money_type) table 上面我写的这个需要进一步改进下 我不知道别的方法是否比他效率更好 | | |
|