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!