Jay Sprenkle wrote:
> I'm not sure if this counts as a bug or not.
>
> SQLite version 3.5.2
> Enter ".help" for instructions
> sqlite> select * from (select user.id from user ) ;
> 0
> 1
> 2
> 3
> 4
> sqlite> select * from (select user.id from user ) where id=1 ;
> SQL error: no such column: id
> sqlite> select * from (select user.id from user ) where user.id=1 ;
> SQL error: no such column: user.id
> sqlite> select * from (select user.id from user ) as blah where blah.id=1 ;
> SQL error: no such column: blah.id
> sqlite> select * from (select user.id from user ) as blah where
> blah.user.id=1 ;
>
> SQL error: no such column: blah.user.id
> sqlite>
>
> Should the result of a subselect have a table name? If not, how do you
> reference it?
>
>
>
Jay,
You are aliasing the wrong thing. Try this instead:
select * from (select user.id as id from user ) where id=1 ;
If you want the subselect result to have a name then you can do this:
select * from
(select user.id as id from user ) as sub where sub.id=1;
HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users