ora-00918

Why doesn't Oracle raise “ORA-00918: column ambiguously defined” for this query?

。_饼干妹妹 提交于 2019-11-27 06:44:28
问题 I've just come across a strange behaviour in Oracle where I would expect ORA-00918 to be raised, but isn't. Take this query, for example. SELECT * FROM USER_TABLES TAB JOIN USER_TRIGGERS TRG ON TRG.TABLE_NAME = TAB.TABLE_NAME WHERE STATUS = 'DISABLED' This query is notionally looking for the details of tables with disabled triggers, but please note that this is not the problem I'm trying to solve. The problem is not unique to this query, the data dictionary, views or tables; as far as I can

SQL: How to find duplicates based on two fields?

五迷三道 提交于 2019-11-27 01:50:21
问题 I have rows in an Oracle database table which should be unique for a combination of two fields but the unique constrain is not set up on the table so I need to find all rows which violate the constraint myself using SQL. Unfortunately my meager SQL skills aren't up to the task. My table has three columns which are relevant: entity_id, station_id, and obs_year. For each row the combination of station_id and obs_year should be unique, and I want to find out if there are rows which violate this

ORA-00918: column ambiguously defined in SELECT *

ⅰ亾dé卋堺 提交于 2019-11-26 11:55:35
Getting ORA-00918: column ambiguously defined: running this SQL: SELECT * FROM (SELECT DISTINCT(coaches.id), people.*, users.*, coaches.* FROM "COACHES" INNER JOIN people ON people.id = coaches.person_id INNER JOIN users ON coaches.person_id = users.person_id LEFT OUTER JOIN organizations_users ON organizations_users.user_id = users.id ) WHERE rownum <= 25 Any suggestions please? A query's projection can only have one instance of a given name. As your WHERE clause shows, you have several tables with a column called ID. Because you are selecting * your projection will have several columns

ORA-00918: column ambiguously defined in SELECT *

别说谁变了你拦得住时间么 提交于 2019-11-26 02:25:34
问题 Getting ORA-00918: column ambiguously defined: running this SQL: SELECT * FROM (SELECT DISTINCT(coaches.id), people.*, users.*, coaches.* FROM \"COACHES\" INNER JOIN people ON people.id = coaches.person_id INNER JOIN users ON coaches.person_id = users.person_id LEFT OUTER JOIN organizations_users ON organizations_users.user_id = users.id ) WHERE rownum <= 25 Any suggestions please? 回答1: A query's projection can only have one instance of a given name. As your WHERE clause shows, you have