Need HELP! with - SQL Plus Select multiple columns -


hi using sql plus , need select 5 columns 4 tables , show result. code used , error get.

select customerid, orderid, aircraftid, quantity, totalcost  customer_table, order_table, aircraft_table, orderline; 

error @ line 1: ora-00918: column ambiguously defined

what code these columns , display them multiple tables. please this.

the reason tried execute sql statement joined 2 or more tables, column same name exists in both tables.

exemple sql query

select suppliers.supplier_id, quantity suppliers, orders suppliers.supplier_id = orders.supplier_id; 

since supplier_id column exists in both suppliers , orders table, need prefix column table name follows:

moreover need link tables between them. if take example above should kind of thing

where suppliers.supplier_id = orders.supplier_id; 

means link table suppliers table orders column supplier_id

this article may understand issue: http://www.sitepoint.com/understanding-sql-joins-mysql-database/


Comments