"Vinay" <[EMAIL PROTECTED]> wrote on 02/14/2006 02:29:45 PM:

> Hi,
>    I am trying to create a view by joining two tables.These tables 
> have a common column which references their parent table. I get the 
> following error when I try to create a view.
> 
> 
> create view trn2 as select * from dbtmsg,dbtrbl where dbtmsg.accxsk=-1
> 
> 
> 
> ERROR 1060 (42S21): Duplicate column name 'accxsk'
> 
> 
> 
> Thank You,
> 
> Any help appreciated,
> 
> Vinay


Since both tables contain a column called `accxsk`, the "SELECT *" part of 
the view's definition will try to list both copies (once from each table). 
Views cannot contain columns with duplicate names. Hence the error.

You have to use the more explicit form of "SELECT col1, col2, col3, ...." 
to individually identify each column you want to see in your view in order 
to avoid this error.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



Reply via email to