Дt
Size: a a a
Дt
TS
G
MC
AS
MC
MC
MC
DN
select QNTY, case when QNTY>0 and QNTY<=0.3 then 0.31тут фиддл - https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=c7aafa5916813fc3345faa9daf5e5394
when QNTY>0.3 and QNTY<=0.6 then 0.62
when QNTY>0.6 and QNTY<=0.9 then 0.94
when QNTY>0 then case when QNTY%0.9=0 then (QNTY/0.9)*0.94
when QNTY-(CAST (QNTY/0.9 as int)*1.0*0.9)<=0.3 then 0.31+(CAST (QNTY/0.9 as int)*1.0*0.94)
when QNTY-(CAST (QNTY/0.9 as int)*1.0*0.9)<=0.6 then 0.62+(CAST (QNTY/0.9 as int)*1.0*0.94)
when QNTY-(CAST (QNTY/0.9 as int)*1.0*0.9)<0.9 then 0.94+(CAST (QNTY/0.9 as int)*1.0*0.94) end
end as new_QNTY
from #test_table
order by 1
TS
ЕА
select QNTY, case when QNTY>0 and QNTY<=0.3 then 0.31тут фиддл - https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=c7aafa5916813fc3345faa9daf5e5394
when QNTY>0.3 and QNTY<=0.6 then 0.62
when QNTY>0.6 and QNTY<=0.9 then 0.94
when QNTY>0 then case when QNTY%0.9=0 then (QNTY/0.9)*0.94
when QNTY-(CAST (QNTY/0.9 as int)*1.0*0.9)<=0.3 then 0.31+(CAST (QNTY/0.9 as int)*1.0*0.94)
when QNTY-(CAST (QNTY/0.9 as int)*1.0*0.9)<=0.6 then 0.62+(CAST (QNTY/0.9 as int)*1.0*0.94)
when QNTY-(CAST (QNTY/0.9 as int)*1.0*0.9)<0.9 then 0.94+(CAST (QNTY/0.9 as int)*1.0*0.94) end
end as new_QNTY
from #test_table
order by 1
ЮП
ЮП
ЮП
ЮП
Дt
ЮП
У
DI