![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Greetings. I'm trying to execute a DB2 command such as: SELECT P.ITEM_NO, D.FILE_NAME FROM PRODDB2.PART P LEFT JOIN PRODDB2.DATA D ON P.OBJ_ID = D.OJB_ID but I get: "D.OJB_ID" is not valid in the context where it is used. SQLSTATE=42703 Ah, but OBJ_ID column is type CHAR(30). So I suppose I may need to match with "like" instead of "=" So I change the last part: ON P.OBJ_ID LIKE D.OJB_ID Alas, that doesn't help: An unexpected token "D" was found following "". Expected tokens may include: ":". SQLSTATE=42601 What is the proper syntax for a join on a non-numeric column? Thanks! |
#3
| |||
| |||
|
|
"DavidFilmer" <use... (AT) davidfilmer (DOT) com> wrote in message news:5ccd19e5-c611-4e14-bb83-0fab55ee8c2f (AT) k36g2000prb (DOT) googlegroups.com... Greetings. *I'm trying to execute a DB2 command such as: * SELECT * * * * P.ITEM_NO, * * * * * * * * *D.FILE_NAME * FROM * * * * * * *PRODDB2.PART * *P * LEFT JOIN * * * * PRODDB2.DATA * *D * ON * * * * * * * *P.OBJ_ID = D.OJB_ID but I get: "D.OJB_ID" is not valid in the context where it is used. SQLSTATE=42703 Ah, but OBJ_ID column is type CHAR(30). *So I suppose I may need to match with "like" instead of "=" *So I change the last part: * ON * * * * * * * *P.OBJ_ID LIKE D.OJB_ID Alas, that doesn't help: * An unexpected token "D" was found following "". *Expected tokens may include: *":". *SQLSTATE=42601 What is the proper syntax for a join on a non-numeric column? Thanks! No difference for non-numeric columns. Please post DDL for the tables and indicate the schema names of the tables. |
#4
| |||
| |||
|
|
Greetings. I'm trying to execute a DB2 command such as: SELECT P.ITEM_NO, D.FILE_NAME FROM PRODDB2.PART P LEFT JOIN PRODDB2.DATA D ON P.OBJ_ID = D.OJB_ID but I get: "D.OJB_ID" is not valid in the context where it is used. SQLSTATE=42703 Ah, but OBJ_ID column is type CHAR(30). So I suppose I may need to match with "like" instead of "=" So I change the last part: ON P.OBJ_ID LIKE D.OJB_ID Alas, that doesn't help: An unexpected token "D" was found following "". Expected tokens may include: ":". SQLSTATE=42601 What is the proper syntax for a join on a non-numeric column? Thanks! |
#5
| |||
| |||
|
|
Where you partly drunk when you typed this or was it a typo when you wrote the question? You have used OJB_id instead of OBJ_ID referring to the table 'D'. |
![]() |
| Thread Tools | |
| Display Modes | |
| |