Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL doesn't work as I want it!!!!!!!
Message
From
13/12/2000 17:47:52
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00452377
Message ID:
00453136
Views:
30
Nadya,

You didn't specify which cCode to use.

SELECT ..., LOOKUP(Towns.county, curTemp.ccode, Towns.ccode, 'ccode') AS MyCounty ...


>Cindy,
>
>I tried this:
>lookups (Towns.county,ccode,Towns.ccode, 'ccode') and it doesn't work, even if I open towns table before SQL. What did I do wrong here?
>
>>LOOKUP(ReturnField, eSearchExpression, SearchedField [, cTagName])
>>
>>SELECT LOOKUP(...) AS MyField ...
>>
>>
>>>>Cindy,
>>>>
>>>>Actually, I tried that, but could not make it work. Could you please show me, how the code should look like it be in my case?
>>>>
>>>>Thanks in advance.
>>>>
>>>>>Nadya,
>>>>>
>>>>>One more idea (for the future) would be to use the LOOKUP() function, as long as you're working in VFP.
>>>>>
>>>>>
>>>>>>>Maybe try by dropping the DISTINCT and add a GROUP BY CCODE clause at the end.
>>>>>>
>>>>>>This solved the problem.
>>>>>>
>>>>>>  select nvl(State,lcState) as State, ;
>>>>>>		nvl(upper(County),lcCounty) as County, ;
>>>>>>		lcCity as City, ;
>>>>>>		curTemp.ccode, curTemp.town, UseGrp, cYear, ;
>>>>>>		VolSales, MedSale, NumSales ;
>>>>>>	 	from curTemp left join Towns on curTemp.ccode=Towns.ccode;
>>>>>>	 	group by 4,5,6,7 ;
>>>>>>	 	into cursor curWork	
>>>>>>
>>>>>>Thanks to everyone.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform