On Mon, 23 Dec 2013 23:50:30 +0100
"E.Pasma" <pasm...@concepts.nl> wrote:

> > .  See if you can make the simplest possible SELECT that comes up  
> > with unexpected results.
> 
> select 0 as depth
> from    (select 1 as depth)
> group by null
> having depth < 1
> ;
> This returns no rows. Thus the HAVING clause refers to the depth
> from the FROM part, not that in the SELECT part. May this be what is  
> causing the unexpected result?

Another good use for strict = ON!  

Column name aliases in the SELECT clause are properly unavailable to the
rest of the query, including the GROUP BY clause. More simply, 

        select 0 as depth
        from  (select 1 as foo) as T
        where depth < 1;

should be a syntax error but 

sqlite> select 0 as depth from (select 1 as foo) as T where depth < 1;
depth     
----------
0

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to