Why is this query invalid? When I write just SRV_ID instead of vt_exam_details.SRV_ID everything works just fine
cl_id
, cl_name_last as CUSTOMER
, vt_animals.an_type
, vt_exam_details.SRV_ID
, vt_services.srv_desc
, vt_exam_details.ex_fee
from vt_clients
join vt_animals using (cl_id)
join vt_exam_headers using (an_id)
join vt_exam_details using (ex_id)
join vt_services using (srv_id)
Error:
Error at Command Line:5 Column:3
Error report:
SQL Error: ORA-00904: "VT_EXAM_DETAILS"."SRV_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Thanks.
-
3is vt_exam_details the right table for SRV_ID?Marc B– Marc B2013年02月17日 06:20:36 +00:00Commented Feb 17, 2013 at 6:20
-
well.your error says that..the table vt_exam_details doesn't have any column named "SRV_ID".Ahmad– Ahmad2013年02月17日 06:26:04 +00:00Commented Feb 17, 2013 at 6:26
-
SQL> describe vt_exam_details EX_ID NOT NULL NUMBER(6) LINE_ITEM NOT NULL NUMBER(6) SRV_ID NOT NULL NUMBER(6) EX_FEE NOT NULL NUMBER(6,2) EX_DESC VARCHAR2(50) }user2079915– user20799152013年02月17日 06:38:36 +00:00Commented Feb 17, 2013 at 6:38
-
I'm sorry, I'm new here, so writing a little messy. as you can see I have that srv_iduser2079915– user20799152013年02月17日 06:46:25 +00:00Commented Feb 17, 2013 at 6:46
2 Answers 2
Because the table vt_exam_details is not in the FROM clause?
answered Feb 17, 2013 at 6:51
Vaishak Suresh
5,86510 gold badges45 silver badges68 bronze badges
Sign up to request clarification or add additional context in comments.
5 Comments
user2079915
but my other tables are not in the FROM clause either
Vaishak Suresh
Could you post the columns in the table? easier to help that way. Also, could the case be different for the column names?
user2079915
SQL> describe vt_exam_details EX_ID NOT NULL NUMBER(6) LINE_ITEM NOT NULL NUMBER(6) SRV_ID NOT NULL NUMBER(6) EX_FEE NOT NULL NUMBER(6,2) EX_DESC VARCHAR2(50) } –
user2079915
I think the answer is that, since I have join vt_services using (srv_id) I don't have to specify the table name for attribute srv_id
Vaishak Suresh
Exactly! otherwise you would get error for
vt_exam_details.ex_fee too.Is there a SRV_ID in table VT_EXAM_DETAILS?
2 Comments
user2079915
SQL> describe vt_exam_details EX_ID NOT NULL NUMBER(6) LINE_ITEM NOT NULL NUMBER(6) SRV_ID NOT NULL NUMBER(6) EX_FEE NOT NULL NUMBER(6,2) EX_DESC VARCHAR2(50) } –
user2079915
I think the answer is that, since I have join vt_services using (srv_id) I don't have to specify the table name for attribute srv_id
default