On Tue, 12 Mar 2013 19:57:26 +0000
Simon Slavin <[email protected]> wrote:
> > Is my rewrite the same as the original?
>
> No. You can't use this construction:
>
> > INNER JOIN (Categories INNER JOIN Object_Categories ON
> > "Categories"."Category_ID"="Object_Categories"."Category_ID")
>
> The parser expects a table name immediately after INNER JOIN.
> Instead you are opening a bracket which is the way one would begin an
> expression.
That construction is perfectly valid except for one detail that Hugh
Darwen calls the TEETH_GNASHER.
sqlite> .tables
sqlite> create table t (t int primary key);
sqlite> insert into t values (1);
sqlite> insert into t values (2);
sqlite> insert into t values (3);
sqlite> select * from t inner join (select min(t) from t) as T;
t min(t)
---------- ----------
1 1
2 1
3 1
The table expression requires a name, even if the name isn't referenced
elsewhere in the query. Of course, to get a correct result, the above
query needs a few corrections:
sqlite> select * from t as a
join (select min(t) as t from t) as T
on a.t = T.t;
t t
---------- ----------
1 1
--jkl
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users