~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/sum_distinct.test

  • Committer: Stewart Smith
  • Date: 2011-01-14 05:13:52 UTC
  • mto: (2086.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: stewart@flamingspork.com-20110114051352-ytdw2wn6thbf4dr8
fix tpyo

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 CROSS JOIN t1 g2 CROSS JOIN t1 g3;
 
59
FROM t1 g1, t1 g2, 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 CROSS JOIN t1 g2 CROSS JOIN t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
 
66
FROM t1 g1, t1 g2, 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 CROSS JOIN t1 g2 CROSS JOIN t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
 
81
FROM t1 g1, t1 g2, 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