Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace
Message
 
 
À
19/05/2011 05:38:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
SAMBA Server
Database:
Visual FoxPro
Divers
Thread ID:
01511100
Message ID:
01511111
Vues:
59
>hi all,
>
>i need help to replace value as ....
>
>flg1  empno value   a1   b1  c1 d1
>a      1    10      
>b      1    15 
>c      1    20 
>d      1    30
>
>*************************************
>flg1  empno value   a1   b1  c1 d1
>a      2    10      
>b      2    15 
>d      2    30
>
>*************************************
>
>flg1  empno value   a1   b1  c1 d1
>     
>b      3    12
>
>*************************************result
>
>flg1  empno value   a1   b1  c1 d1
>a      1    10      10   15  20 30
>*************************
>a      2    10      10   15   0  30
>***********************************
>b      3     12     0    12   0  0
>
>
>
>
>thanks

We can try the following (this is from the top of my head)
select min(flg1) as flg1, EmpNo, 
min(Value) as Value,
max(iif(flg1='a',Value,0)) as a1,
max(iif(flg1='b',Value,0)) as b1,
max(iif(flg1='c',Value,0)) as c1,
max(iif(flg1='d',Value,0)) as d1
from EmpInfo 
GROUP BY EmpNo
ORDER BY EmpNo
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform