Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with SELECT
Message
From
05/08/2011 12:22:17
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01520239
Message ID:
01520247
Views:
56
Thanks Sergey -
With ANSI OFF, this produces 4 records (the correct answer).
SELECT st_name, Current.* ;
FROM tipdatabase!tip T ;
INNER JOIN tipdatabase!current  ;
ON t.tip_id = current.tip_id ;
WHERE ALLTRIM(current.sc1_2000) == "STP"
But this
thisfield = 'current.sc1_2000'

SELECT st_name, Current.* ;
FROM tipdatabase!tip T ;
INNER JOIN tipdatabase!current  ;
ON t.tip_id = current.tip_id ;
WHERE ALLTRIM(eval(thisfield)) == "STP"
Produces no records. Same result with ANSI on.




>Change to
>
>WHERE ALLTRIM(eval(thisfield)) == "STP"
>
>
>See http://www.berezniker.com/content/pages/visual-foxpro/string-comparison-vfp for explanation
>
>
>>Can some one tell me why the WHERE clause in this select is being ignored? It pulls all the records.
>>
>>
>>thisfield = 'current.sc1_2000'
>>
>>SELECT st_name, Current.* ;
>>FROM tipdatabase!tip T ;
>>INNER JOIN tipdatabase!current  ;
>>ON t.tip_id = current.tip_id ;
>>WHERE ALLTRIM(eval(thisfield)) = "STP"
>>
>>
>>Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform