Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - Error correlating fields
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL - Error correlating fields
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01147892
Message ID:
01147892
Views:
158
I am getting an error for this simple SQL statement. SQL:Error correlating fields. Can someone tell me what is wrong with this statement?

SELECT SUBSTR(a.PAN_CODE,1,1) AS PAN, a.SHORT_DESC, a.PAN_ORDER1 ;
FROM PANS a;
INTO CURSOR PAN1 ;
ORDER BY a.PAN_ORDER1 ASC ;
WHERE VAL(a.PAN_ORDER1) IN ( ;
SELECT MAX(VAL(b.PAN_ORDER1)) FROM PANS b ;
WHERE SUBSTR(a.PAN_CODE,1,1) == SUBSTR(b.PAN_CODE,1,1))

I am trying to get the distinct record for the SUBSTR(pan_code,1,1), but want all of the fields included in the cursor. Here's an example of the pans table.

PAN_CODE C(2)
SHORT_DESC C(5)
PAN_ORDER1 C(3)

Example Records:
"A1","5 1/2","001"
"A2","5 1/2","002"
"A3","5 1/2","003" *
"B1","6 1/4","004"
"B3","6 1/4","005" *
"C2","3 RND","006"
"C3","3 RND","007" *

I just want the records with the asterisk returned.

Thanks in advance!

John
John Fatte'

Life is beautiful!
Next
Reply
Map
View

Click here to load this message in the networking platform