我有以下问题,我想按批次进行减法,也就是说我将一个批次'n_lot'的最小值与同一批次的其他值相减 我尝试使用以下查询
select T_AO.N_AO, n_lot, montat_soum
, montat_soum - min(montat_soum) over() as resultat
, designation_entr
from t_soumission, t_entreprise, T_AO
where T_AO.N_AO='02/STG/2023' and t_soumission.cod_entr=t_entreprise.cod_entr
order by resultat
如名为“结果 1”的图像所示 而我想获得如图“结果2”所示的结果
非常感谢
select
montat_soum,
montat_soum - min(montat_soum) over(partition by n_lot) as resultat,
T_AO.N_AO,
n_lot
from t_soumission
join T_AO
on T_AO.N_AO='02/STG/2023'
order by n_lot
我找到了解决方案,如果它对其他人有帮助的话