~ubuntu-branches/ubuntu/quantal/drizzle/quantal

« back to all changes in this revision

Viewing changes to tests/t/sum_distinct.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2011-02-14 12:40:34 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20110214124034-eih75vcr64qt4db1
Tags: 2011.02.10-0ubuntu1
* New upstream release.
* Incorporated all patches upstream.
* Added unix-socket-protocol package. Disabled it by default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
  SUM(DISTINCT LENGTH(g1.name)) s1,
57
57
  SUM(DISTINCT SUBSTRING(g2.name, 1, 3)) s2,
58
58
  SUM(DISTINCT LENGTH(SUBSTRING(g3.name, 1, 4))) s3
59
 
FROM t1 g1, t1 g2, t1 g3;
 
59
FROM t1 g1 CROSS JOIN t1 g2 CROSS JOIN t1 g3;
60
60
 
61
61
SELECT
62
62
  SQL_BIG_RESULT
63
63
  SUM(DISTINCT LENGTH(g1.name)) s1,
64
64
  SUM(DISTINCT SUBSTRING(g2.name, 1, 3)) s2,
65
65
  SUM(DISTINCT LENGTH(SUBSTRING(g3.name, 1, 4))) s3
66
 
FROM t1 g1, t1 g2, t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
 
66
FROM t1 g1 CROSS JOIN t1 g2 CROSS JOIN t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
67
67
 
68
68
# here we explicitly request summing through temporary table (so
69
69
# Item_sum_sum_distinct::copy_or_same() is called)
78
78
  SUM(DISTINCT LENGTH(g1.name)) s1,
79
79
  SUM(DISTINCT SUBSTRING(g2.name, 1, 3)) s2,
80
80
  SUM(DISTINCT LENGTH(SUBSTRING(g3.name, 1, 4))) s3
81
 
FROM t1 g1, t1 g2, t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
 
81
FROM t1 g1 CROSS JOIN t1 g2 CROSS JOIN t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
82
82
 
83
83
# this test demonstrates that strings are automatically converted to numbers
84
84
# before summing