Bonjour,


Je cherche à mettre à jour une valeur de ma base coef_vente en fonction de la valeur d'une autre dpx_art dans la table article.

J'ai essaye de faire cela comme requête mais cela ne fonctionne pas.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if (article.dpx_art <= 0.5)
BEGIN
	UPDATE article
	SET coef_vente = 10
END
 
Else 
if ( article.dpx_art > 0.5 AND article.dpx_art <= 5)
BEGIN
	UPDATE article
	SET coef_vente = -0.6666*{article.dpx_art}+10.33
END
 
Else 
if ( article.dpx_art > 5 AND article.dpx_art <= 13)
BEGIN
	UPDATE article
	SET coef_vente = -0.375*{article.dpx_art}+8.875
END
 
 
 
//Else if {article.dpx_art} > 13 AND {article.dpx_art} <= 23 then -0.06*{article.dpx_art}+4.78
//Else if {article.dpx_art} > 23 AND {article.dpx_art} <= 61 then -0.01052632*{article.dpx_art}+3.642105263
//Else if {article.dpx_art} > 61 AND {article.dpx_art} <= 107 then -0.00652174*{article.dpx_art}+3.397826087
//Else if {article.dpx_art} > 107 AND {article.dpx_art} <= 153 then -0.01086957*{article.dpx_art}+3.863043478
//Else if {article.dpx_art} > 153 AND {article.dpx_art} <= 305 then -0.00197368*{article.dpx_art}+2.501973684
//Else if {article.dpx_art} > 305 AND {article.dpx_art} <= 763 then -0.00021834*{article.dpx_art}+1.96659839
//Else if {article.dpx_art} > 763 then 1.6
Avez-vous une solution?

Merci d'avance

Cordialement,

Olivier