On Apr 1, 2012, at 3:09 PM, Baruch Burstein wrote:
> Does sqlite not support table aliases in update statements?
Nope, no aliasing in the update itself.
> Is there a way
> to work around this to get the affect of
>
> update table1 t1
>
> set col1 = col1 * 2
>
> where col1 <= (select avg(col1)
>
> from table1
> where col2=t1.col2);
Yes, something along these lines:
update table1
set col1 = col1 * 2
where col1 <=
(
select avg( table_one.col1 )
from table1 table_one
where table_one.col2 = table1.col2
group by table_one.col2
)
In other words, you can alias anything you want in the sub-select clause, but
not in the update clause itself.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users