Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get 3rd field from previous 2 fields
Message
 
À
05/10/2006 16:03:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01159849
Message ID:
01159855
Vues:
16
>Hi all,
>
>I have mytable with 2 fields ( Name1 and Name2 ) and want to get Newtable
>with 1 field called Name3:
>
>blank and blank2 are fixed.
>
>if Name1 = blank then Name3 must = ccccc
>
>if Name1 = aaaaa then Name3 must = aaaaa
>
>if Name1 = blank then Name3 must = blank and not blank2
>
>...............
>
>
>mytable
>
>Name1:    Name2:
>
>aaaaa    bbbbb
>blank    ccccc
>blank    blank2
>ddddd    eeeee
>fffff    ggggg
>blank    hhhhh
>
>Newtable
>
>Name3:
>
>aaaaa
>ccccc
>blank
>ddddd
>fffff
>hhhhh
>
>
>
>How to do this with SQL ?
>
>TIA
SELECT IIF(ALLTRIM(Field1)==[blank],;
       IIF(ALLTRIM(Field2)==[blank2],[blank],Field2),;
       Field1) AS Field3
FROM MyTable;
INTO CURSOR NerTable
BROWSE NORMAL
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform