根据条件更改列值

时间:2018-07-05 15:35:00

标签: sql oracle

SELECT fund.sak_fund_group || ' - ' || fund.dsc_fund_group AS FundCodeGrp, 
       fund.sak_fund_group AS SakFundCodeGrp, 
       xref.dte_effective AS EffectiveDate, 
       xref.dte_end AS EndDate,  
       xref.dte_last_update AS LastUpdateDate 
FROM   T_MC_RATE_CELL rate,
       T_MC_AID_GRP aid,
       T_FUND_CDE_GRP fund,
       T_MC_REGION region,
       T_MC_RATE_FUND_GRP_XREF xref

我正在使用上述查询提取数据。我需要根据EndDate更改FundCodeGrp的数据。如果enddate是!= 12/31/2299 ,我需要将SakFundCodeGrp值从上面的查询传递到下面的查询,以获取新的FundCodeGrp值并替换为旧值。

SELECT sak_fund_group || ' - ' || dsc_fund_group as FundCodeGroup
from A_T_FUND_CDE_GRP
WHERE sak_fund_group = " + sakFundCode + " 
    and dsc_fund_group IS NOT NULL 
    and cde_action = 'U' 
    and rownum < 2 
order by Dte_Sysdate asc

有办法吗?

0 个答案:

没有答案