Re: [sqlite] union-having bug

2011-12-04 Thread Gillman, David
Is this expected behavior?  (The failure of my query to return a row.)

David
  
-Original Message-
From: Kit [mailto:kit.sa...@gmail.com] 
Sent: Saturday, December 03, 2011 5:24 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] union-having bug

2011/12/3 Gillman, David :
> Is this behavior known?  The third query returns no rows even though bar = 1.
> sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 
> sqlite> foo, 1 bar union select 1 ind, 1 foo, 0 bar) group by ind 
> sqlite> having bar > 0;

select ind, sum(foo) fooo, sum(bar) barr from (select 1 ind, 0 foo, 1 bar union 
select 1 ind, 1 foo, 0 bar) group by ind having barr >0;
1|1|1
--
Kit
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] union-having bug

2011-12-02 Thread Gillman, David
Hmm, the mailer changed my output.  Here's what I meant:

sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind;
ind|foo|bar
1|1|1

sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind having foo > 0;
ind|foo|bar
1|1|1

sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind having bar > 0;

sqlite> select * from (select ind, sum(foo) foo, sum(bar) bar from (select 1 
ind, 0 foo, 1 bar union select 1 ind, 1 foo, 0 bar) group by ind) where bar > 0;
ind|foo|bar
1|1|1

sqlite>

-Original Message-
From: Gillman, David [mailto:dgill...@akamai.com] 
Sent: Friday, December 02, 2011 6:37 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] union-having bug

Hi,

Is this behavior known?  The third query returns no rows even though bar = 1.

sqlite> select region, sum(edge) edge, sum(infra) infra from (select 1 region, 
0 edge, 1 infra union select 1 region, 1 edge, 0 infra) group by 
region;region|edge|infra
1|1|1
sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind;
ind|foo|bar
1|1|1
sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind having foo > 0;
ind|foo|bar
1|1|1
sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind having bar > 0;
sqlite> select * from (select ind, sum(foo) foo, sum(bar) bar from (select 1 
ind, 0 foo, 1 bar union select 1 ind, 1 foo, 0 bar) group by ind) where bar > 0;
ind|foo|bar
1|1|1
sqlite>

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


[sqlite] union-having bug

2011-12-02 Thread Gillman, David
Hi,

Is this behavior known?  The third query returns no rows even though bar = 1.

sqlite> select region, sum(edge) edge, sum(infra) infra from (select 1 region, 
0 edge, 1 infra union select 1 region, 1 edge, 0 infra) group by 
region;region|edge|infra
1|1|1
sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind;
ind|foo|bar
1|1|1
sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind having foo > 0;
ind|foo|bar
1|1|1
sqlite> select ind, sum(foo) foo, sum(bar) bar from (select 1 ind, 0 foo, 1 bar 
union select 1 ind, 1 foo, 0 bar) group by ind having bar > 0;
sqlite> select * from (select ind, sum(foo) foo, sum(bar) bar from (select 1 
ind, 0 foo, 1 bar union select 1 ind, 1 foo, 0 bar) group by ind) where bar > 0;
ind|foo|bar
1|1|1
sqlite>

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