~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to mysql-test/r/subselect3.result

  • Committer: Bazaar Package Importer
  • Author(s): sean finney
  • Date: 2007-05-13 12:32:45 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513123245-8c3l187dk34cz2ar
Tags: 5.0.41-2
the previous "translation changes" inadvertently introduced unrelated
changes in the package control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
432
432
explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
433
433
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
434
434
1       PRIMARY t2      ALL     NULL    NULL    NULL    NULL    7       
435
 
2       DEPENDENT SUBQUERY      t1      ref_or_null     idx     idx     10      t2.oref,func    4       Using where; Using index; Full scan on NULL key
 
435
2       DEPENDENT SUBQUERY      t1      ref_or_null     idx     idx     10      test.t2.oref,func       4       Using where; Using index; Full scan on NULL key
436
436
select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
437
437
oref    a       Z
438
438
ee      NULL    NULL
457
457
from t2;
458
458
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
459
459
1       PRIMARY t2      ALL     NULL    NULL    NULL    NULL    7       
460
 
2       DEPENDENT SUBQUERY      t1      ref     idx     idx     5       t2.oref 2       Using where; Using temporary; Using filesort
 
460
2       DEPENDENT SUBQUERY      t1      ref     idx     idx     5       test.t2.oref    2       Using where; Using temporary; Using filesort
461
461
select oref, a, 
462
462
a in (select min(ie) from t1 where oref=t2.oref 
463
463
group by grp having min(ie) > 1) Z 
645
645
2       2       0
646
646
3       3       1
647
647
drop table t1,t2;
 
648
CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
 
649
INSERT INTO t1 VALUES (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
 
650
(2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'),(3,3,'j'), (3,2,'k'), (3,1,'l'),
 
651
(1,9,'m');
 
652
CREATE TABLE t2 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
 
653
INSERT INTO t2 SELECT * FROM t1;
 
654
SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b))
 
655
as test FROM t1 GROUP BY a;
 
656
a       MAX(b)  test
 
657
1       9       m
 
658
2       3       h
 
659
3       4       i
 
660
SELECT * FROM t1 GROUP by t1.a
 
661
HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
 
662
HAVING MAX(t2.b+t1.a) < 10));
 
663
a       b       c
 
664
SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
 
665
a       b       c
 
666
1       3       c
 
667
2       3       h
 
668
3       3       j
 
669
1       4       d
 
670
3       4       i
 
671
1       9       m
 
672
SELECT a, MAX(b),
 
673
(SELECT COUNT(DISTINCT t.c) FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) 
 
674
LIMIT 1) 
 
675
as cnt, 
 
676
(SELECT t.b FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) 
 
677
as t_b,
 
678
(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) 
 
679
as t_b,
 
680
(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) ORDER BY t.c LIMIT 1)
 
681
as t_b
 
682
FROM t1 GROUP BY a;
 
683
a       MAX(b)  cnt     t_b     t_b     t_b
 
684
1       9       1       9       m       m
 
685
2       3       1       3       h       h
 
686
3       4       1       4       i       i
 
687
SELECT a, MAX(b),
 
688
(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as test 
 
689
FROM t1 GROUP BY a;
 
690
a       MAX(b)  test
 
691
1       9       m
 
692
2       3       h
 
693
3       4       i
 
694
DROP TABLE t1, t2;