KSquared
KSquared

Reputation: 23

Oracle Invalid Identifier ORA-00904

I keep getting this error trying to run this simple Join.....

SELECT docregitem.reviewdate, docregitem.nclient, client.name
FROM docregitem, client
     INNER JOIN client
      ON docregitem.nclient = client.nclient

ORA-00904: "DOCREGITEM"."NCLIENT": invalid identifier

I can do a select and all the columns are present and correct...

Upvotes: 1

Views: 733

Answers (2)

Dharmesh Porwal
Dharmesh Porwal

Reputation: 1406

SELECT docregitem.reviewdate, docregitem.nclient, client.name
FROM docregitem
INNER JOIN client
ON docregitem.nclient = client.nclient

you try this one as you used client table twice one with simple join and other with inner join without giving the alias name to the table so the compiler is confused in selecting and comparing column from client table.

Upvotes: 1

Gordon Linoff
Gordon Linoff

Reputation: 1269493

I think the query you want is:

SELECT dr.reviewdate, dr.nclient, c.name
FROM docregitem dr INNER JOIN
     client c
     ON dr.nclient = c.nclient;

Your from clause has a comma in it. This is a lot like a cross join, but it affects the columns. These are not known in the on clause, which is what is causing the problem.

Upvotes: 1

Related Questions