diff options
author | bell@sanja.is.com.ua <> | 2004-03-16 17:35:49 +0200 |
---|---|---|
committer | bell@sanja.is.com.ua <> | 2004-03-16 17:35:49 +0200 |
commit | c9938b9dff045915bee6f672bb7306a2da8a9b8a (patch) | |
tree | 2df566fe70f19f7a99dd06d250c5fce2e4a6a5bd /mysql-test/t/derived.test | |
parent | e970ff9e87ab1b9eb6e66f9deff9522ac6af3fdf (diff) | |
parent | 7593d8a0563d44e44f85bef6aa0487499d782481 (diff) | |
download | mariadb-git-c9938b9dff045915bee6f672bb7306a2da8a9b8a.tar.gz |
merge
Diffstat (limited to 'mysql-test/t/derived.test')
-rw-r--r-- | mysql-test/t/derived.test | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 0ef56191b7c..ddd2b36e78e 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -188,7 +188,6 @@ INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00 select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP; drop table t1, t2, t3; - # # explain derived # @@ -206,3 +205,11 @@ insert into t2 values (1,7),(2,7); explain select a from t2 where a>1; explain select a from (select a from t2 where a>1) tt; drop table t2; + +# +# select list counter +# +CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`)); +insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10); +SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices; +DROP TABLE t1; |