Ok, so parentheses "hide" the columns in the present clause? There must be a 
common rule for this...

 

And yes, I know you can explicitly use "table.column", but in this case the 
code comes from the user and conflicts with my own columns.

Hence, I have to think of a way to avoid column conflicts.

 

Thanks for your reply.
 
> From: slav...@bigfraud.org
> Date: Sat, 7 Nov 2009 23:55:52 +0000
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Avoiding "Ambigious column"?
> 
> 
> On 7 Nov 2009, at 10:56pm, Kristoffer Danielsson wrote:
> 
> > SELECT SUM(Salary - TotalSpent) / 100 FROM (T2 NATURAL JOIN T4) 
> > NATURAL JOIN (T2 NATURAL JOIN T3);
> >
> > Error: Ambigious column name: Salary
> >
> > However, if I add two parentheses around "T2 NATURAL JOIN T4", the 
> > error goes away:
> >
> > SELECT SUM(Salary - TotalSpent) / 100 FROM ((T2 NATURAL JOIN T4)) 
> > NATURAL JOIN (T2 NATURAL JOIN T3);
> >
> > Why is this so?
> 
> Because there's no longer any reason to wonder if the Salary column 
> could come from T2 NATURAL JOIN T4: you haven't referred to either of 
> them directly.
> 
> Another way to get rid of the error message would be to specify 
> T2.Salary or T3.Salary.
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
                                          
_________________________________________________________________
Nya Windows 7 gör allt lite enklare. Hitta en dator som passar dig!
http://windows.microsoft.com/shop
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to