Re: [sqlite] SELECT statement seems to return incorrect results

2012-04-16 Thread Igor Tandetnik
Ludovic VP  wrote:
> REF: 
> http://stackoverflow.com/questions/10171403/why-does-select-results-differ-between-mysql-and-sqlite
> Consider these statements:
> create table foo (id INT, score INT);
> insert into foo values (106, 4);insert into foo values (107, 3);insert into 
> foo values (106, 5);insert into foo values (107, 5);
> select T1.id, avg(T1.score) avg1from foo T1group by T1.idhaving not exists ( 
> select T2.id, avg(T2.score) avg2 from foo T2 group
> by T2.id having avg2> avg1); 
> 
> The select statement returns:id avg1 -- --106 4.5 107 4.0
> Shouldn't it return:id avg1 -- --106 4.5
> instead?

Looks like a bug to me, for what it's worth.
-- 
Igor Tandetnik

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


[sqlite] SELECT statement seems to return incorrect results

2012-04-16 Thread Ludovic VP

Hi,
REF: 
http://stackoverflow.com/questions/10171403/why-does-select-results-differ-between-mysql-and-sqlite
Consider these statements:
create table foo (id INT, score INT);
insert into foo values (106, 4);insert into foo values (107, 3);insert into foo 
values (106, 5);insert into foo values (107, 5);
select T1.id, avg(T1.score) avg1from foo T1group by T1.idhaving not exists (    
select T2.id, avg(T2.score) avg2    from foo T2    group by T2.id    having 
avg2> avg1);

The select statement returns:id          avg1      --  --106    
     4.5       107         4.0     
Shouldn't it return:id          avg1      --  --106         4.5 
      
instead?
I'm using 3.7.7.1
Kindly,
Ludovic Vaugeois-Pepin
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users