Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get 3rd field from previous 2 fields
Message
 
To
05/10/2006 16:03:38
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01159849
Message ID:
01159855
Views:
15
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform