-
Is there a way to make the following select statement work?
SELECT hsn, location, location_desc
FROM samples, locations
WHERE samples.location_seq = locations.location_seq
and hsn = &hsn;
ERROR at line 1:
ORA-00918: column ambiguously defined
SQL> describe samples
Name Null? Type
------------------------------- -------- ----
HSN NOT NULL NUMBER(10)
LOCATION VARCHAR2(20)
LOCATION_SEQ NUMBER(6)
SQL> describe locations
Name Null? Type
------------------------------- -------- ----
LOCATION NOT NULL VARCHAR2(20)
LOCATION_SEQ NOT NULL NUMBER(6)
LOCATION_TYPE VARCHAR2(12)
LOCATION_DESC VARCHAR2(250)
Thank you,
mcorbin
-
SELECT hsn, samples.location, location_desc
FROM samples, locations
WHERE samples.location_seq = locations.location_seq
and hsn = &hsn;
?
-
Originally posted by mcorbin
Is there a way to make the following select statement work?
SELECT hsn, location, location_desc
FROM samples, locations
WHERE samples.location_seq = locations.location_seq
and hsn = &hsn;
ERROR at line 1:
ORA-00918: column ambiguously defined
SQL> describe samples
Name Null? Type
------------------------------- -------- ----
HSN NOT NULL NUMBER(10)
LOCATION VARCHAR2(20)
LOCATION_SEQ NUMBER(6)
SQL> describe locations
Name Null? Type
------------------------------- -------- ----
LOCATION NOT NULL VARCHAR2(20)
LOCATION_SEQ NOT NULL NUMBER(6)
LOCATION_TYPE VARCHAR2(12)
LOCATION_DESC VARCHAR2(250)
Thank you,
mcorbin
LOCATION is in both tables. You need to specify something like:
SELECT s.hsn, s.location, l.location_desc
FROM samples s, locations l
WHERE s.location_seq = l.location_seq
and s.hsn = &hsn;
Jeff Hunter
-
Thanks Jeff,
You would have thought I could have figured that out, I should be banished to the dbasupport.com dungeon.
Thanks again,
mcorbin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|