Reputation: 3865
This is working fine
SELECT i.*,o.*,p.*
FROM orders o
INNER JOIN oitems i
ON i.orderid = o.orderid
LEFT OUTER JOIN products p
ON i.catalogid = p.catalogid
however i want to perform a nested select as an example this is giving the coulmn x exists more than once
SELECT AA.*,
FROM (
SELECT i.*,o.*,p.*
FROM orders o
INNER JOIN oitems i
ON i.orderid = o.orderid
LEFT OUTER JOIN products p
ON i.catalogid = p.catalogid ) AA
i know the second example makes no sense , but i need another select with groupping, is there a way to fix the coulm exists more than once error without having to specify the column names in the select statement?
Upvotes: 0
Views: 362
Reputation: 3591
You have mention column names specifically. I can see that you are using "*". you have to use like select i.columnName,o.columnName
etc
Upvotes: 0
Reputation: 171491
By using *
, you are getting the same column more than once in your output. To avoid, this, specifically state the columns you want returned, instead.
The culprits are likely orderid
and catalogid
which both exist in more than one table, but there may be others.
Upvotes: 3