Bonjour;
Je voudrais insérer des lignes dans une table en tenant compte des condition sur des champs de la table source.
j'ai fait une série de Case qui ne marche pas apparemment.
quelqu'un peut il m'aider svp

merci d'avance




Code sql : 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
30
31
32
33
34
 
 
INSERT [APtValues]
           ([MId]
           ,[ProId]
           ,[SitId]
           ,[GrValue]
           ,[CreationDate])
 
SELECT     
            [MId]
           ,A.[ProId]
           ,A.[SitId]
           ,(CASE WHEN A.Orientation = 'FC' THEN 
                                   case when A.IsG = 'RB' then 
                                   case A.IsG when '1' then SUM (A.AmtValue)
                                   end end  
                  ELSE  case when A.Dire = 'XA' then  SUM (A.AmtValue)end                
             END  ) As GrValue
 
 
           ,GETDATE ()
 
FROM AP_Detail A 
 
 
     group by [MId]
              ,A.[ProId]
              ,A.[SitId]
              ,A.Orientation
              A.Dire
 
 
--==========