Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constant value from file2
Message
From
19/07/2015 20:06:56
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 5
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01621990
Message ID:
01622267
Views:
59
>>>>Hi All:
>>>>
>>>>This is file2:
>>>>
>>>>
>>>>cKey     Desc
>>>>'1'          one
>>>>'2'          two
>>>>
>>>>
>>>>I want to run an SQL statement, something like this:
>>>>
>>>>
>>>>SELECT file1.*, '1' cKey, ;
>>>>file2.desc Desc2 ;
>>>>FROM file1 ;
>>>>INNER JOIN file2 ;
>>>>ON file1.cKey = file2.cKey ;
>>>>INTO CURSOR c1
>>>>
>>>>
>>>>that will produce the following:
>>>>
>>>>
>>>>Fields from file1     Desc2
>>>>... ... ... ...               one
>>>>... ... ... ...               one
>>>>... ... ... ...               one
>>>>
>>>>
>>>>The problem is that I get a message that 'Column ckey is not found'
>>>>
>>>>Please note that I obviously want the most elegant solution, but if necessary, please give a solution that will work in VFP 5.0.
>>>>
>>>>Thanks,
>>>>
>>>>Yossi
>>>
>>>select file1.*, file2.*
>>>from file1, file2 
>>>where file2.cKey = '1'
>>
>>Think you need the join
>>
>>SELECT file1.*, ;
>>file2.desc Desc2 ;
>>FROM file1 ;
>>INNER JOIN file2 ;
>>ON file1.cKey = file2.cKey ;
>>where file1.cKey = '1' ;
>>INTO CURSOR c1
>>
>
>File1 doesn't have a cKey column. The way I wrote the query was supposed to create a cross join which is the intention of the query.

I used your original solution and it worked fine. Thanks.
Previous
Reply
Map
View

Click here to load this message in the networking platform