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

Reply via email to