mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
reset() split in 2 function clear() & add()
aggregate function reinitialization (if no rows was found) made with help of clear() (fixed BUG#860) mysql-test/r/subselect.result: test for BUG#860 mysql-test/t/subselect.test: test for BUG#860 sql/item_sum.cc: reset() replaced with clear() sql/item_sum.h: reset() replaced with clear() (reset now is just composition of clear() and add()) sql/item_uniq.h: reset() replaced with clear() sql/sql_select.cc: removed NULL value assigment, now it will be done by clear() call function for clearing if there was not found any row in group sql/sql_select.h: function for clearing if there was not found any row in group
This commit is contained in:
parent
c2d54add7e
commit
85f7a6978b
7 changed files with 69 additions and 45 deletions
|
|
@ -912,3 +912,13 @@ select * from t1 where s1 > (select max(s2) from t1);
|
|||
-- error 1266
|
||||
select * from t1 where s1 > any (select max(s2) from t1);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# aggregate functions reinitialization
|
||||
#
|
||||
create table t1(toid int,rd int);
|
||||
create table t2(userid int,pmnew int,pmtotal int);
|
||||
insert into t2 values(1,0,0),(2,0,0);
|
||||
insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
|
||||
select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
|
||||
drop table t1, t2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue