Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the value of GETTHISVAL
Message
From
03/02/2004 22:49:35
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00873652
Message ID:
00873733
Views:
23
I'm sorry that I did not make my question clear. I need to get all data in TEST1 and TEST3.GetThisVal column. My problem is that TEST3 uses a numeric NWHSE code whereas TEST1 uses a character CWHSE code. I need to join to TEST2 to get the character CWHSE value. Based on the sample below, the desired results would be:
nwhse  cprod  GetThisVal
1      "A"      1
1      "C"      3
2      "B"     22
3      "A"    111
3      "D"    222
David, I tried the query below but it does not return the desired results above.

>Ramil,
>
>Can you give the exact relations between these tables? I'm not sure I'm guessing correctly what you really want as the result:
>
>
select test1.*, test3.GetThisVal ;
>   from test1 ;
>   inner join test2 ;
>      on test1.nwhse = test2.nwhse ;
>   inner join test3 ;
>      on test2.cwhse = test3.cwhse and test1.cprod = test3.cprod ;
>   into cursor theresult
>
>
>>Hi all,
>>Considering these test tables, can I get all the columns of TEST1 and TEST3.GetThisVal column using a single select-sql? Also, the query must be using the JOIN clause as opposed to the WHERE clause.
>>
>>close databases all
>>set safety off
>>set confirm off
>>create table test1 (nwhse i, cprod c(1))
>>insert into test1 values (1,'A')
>>insert into test1 values (1,'C')
>>insert into test1 values (2,'B')
>>insert into test1 values (2,'C')
>>insert into test1 values (3,'B')
>>insert into test1 values (3,'A')
>>insert into test1 values (3,'D')
>>
>>create table test2 (nwhse i, cwhse c(2))
>>insert into test2 values (1,'W1')
>>insert into test2 values (2,'W2')
>>insert into test2 values (3,'W3')
>>
>>create table test3 (cwhse c(2), cprod c(1), getthisval i)
>>insert into test3 values ('W1','A',1)
>>insert into test3 values ('W1','B',2)
>>insert into test3 values ('W1','C',3)
>>insert into test3 values ('W2','A',11)
>>insert into test3 values ('W2','B',22)
>>insert into test3 values ('W3','A',111)
>>insert into test3 values ('W3','D',222)
>>
>>TIA
ramil
~~ learning to stand still
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform