Toms1999 commented on issue #54699:
URL: https://github.com/apache/doris/issues/54699#issuecomment-3183544526

   WITH base1 as (
       select
           *,
           case
               when rd_rl_pre_entry <= 0.27 then RANDOM()
               else -9999
               end as rd_rl_exp
       from rm_idt.syq_dt_limitdown_25july_plf3n4_base
   ),
        base as (
            select
                *,
                case
                    when rd_rl_exp<0 then ''
                    when rd_rl_exp<=0.2 then '0.'
                    when rd_rl_exp<=0.4 then '1.%'
                    when rd_rl_exp<=0.6 then '2.%'
                    when rd_rl_exp<=0.8 then '3.%'
                    else '4.降幅80%'
                    end as exp_tag,
                case
                    when rd_rl_exp<0 then ''
                    when rd_rl_exp<=0.2 then (CAST(currAccountLimit AS DECIMAL) 
/ 100)
                    when rd_rl_exp<=0.4 then greatest((CAST(currAccountLimit AS 
DECIMAL) / 100)*0.8, cast(rl_bottom_aftervalue as DECIMAL))
                    when rd_rl_exp<=0.6 then greatest((CAST(currAccountLimit AS 
DECIMAL) / 100)*0.6, cast(rl_bottom_aftervalue as DECIMAL))
                    when rd_rl_exp<=0.8 then greatest((CAST(currAccountLimit AS 
DECIMAL) / 100)*0.4, cast(rl_bottom_aftervalue as DECIMAL))
                    else greatest((CAST(currAccountLimit AS DECIMAL) / 
100)*0.2, cast(rl_bottom_aftervalue as DECIMAL))
                    end as after_value_moni
            from base1
        )
   
   SELECT
       postLoanLevelF,
       rl_entry_liushi_thick,
       rl_entry_liushi_thin,
       postLoanThin2LevelF,
       exp_tag,
       CASE
           when rd_rl_exp<0 then ''
           when rd_rl_exp<=0.2 then '0.'
           when rd_rl_exp>0.2 and (CAST(currAccountLimit AS DECIMAL) / 100) <= 
cast(after_value_moni as DECIMAL) then ''
           else ''
           end as if_rl_available,
       count(customer_id) as cnt,
       sum(cast(limit_now_all AS DECIMAL)) as limit_now_all,
       sum(cast(after_value_moni as DECIMAL)) as after_value,
       sum(mix_now_price) as mix_now_price
   
   FROM base
   GROUP BY 1,2,3,4,5,6;


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to