OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 14 matching lines...) Expand all Loading... |
25 INSERT INTO songs VALUES(3,'two',3); | 25 INSERT INTO songs VALUES(3,'two',3); |
26 INSERT INTO songs VALUES(4,'three',5); | 26 INSERT INTO songs VALUES(4,'three',5); |
27 INSERT INTO songs VALUES(5,'one',7); | 27 INSERT INTO songs VALUES(5,'one',7); |
28 INSERT INTO songs VALUES(6,'two',11); | 28 INSERT INTO songs VALUES(6,'two',11); |
29 } | 29 } |
30 set result [execsql { | 30 set result [execsql { |
31 SELECT DISTINCT artist,sum(timesplayed) AS total | 31 SELECT DISTINCT artist,sum(timesplayed) AS total |
32 FROM songs | 32 FROM songs |
33 GROUP BY LOWER(artist) | 33 GROUP BY LOWER(artist) |
34 }] | 34 }] |
35 puts result=$result | |
36 do_test select8-1.1 { | 35 do_test select8-1.1 { |
37 execsql { | 36 execsql { |
38 SELECT DISTINCT artist,sum(timesplayed) AS total | 37 SELECT DISTINCT artist,sum(timesplayed) AS total |
39 FROM songs | 38 FROM songs |
40 GROUP BY LOWER(artist) | 39 GROUP BY LOWER(artist) |
41 LIMIT 1 OFFSET 1 | 40 LIMIT 1 OFFSET 1 |
42 } | 41 } |
43 } [lrange $result 2 3] | 42 } [lrange $result 2 3] |
44 do_test select8-1.2 { | 43 do_test select8-1.2 { |
45 execsql { | 44 execsql { |
46 SELECT DISTINCT artist,sum(timesplayed) AS total | 45 SELECT DISTINCT artist,sum(timesplayed) AS total |
47 FROM songs | 46 FROM songs |
48 GROUP BY LOWER(artist) | 47 GROUP BY LOWER(artist) |
49 LIMIT 2 OFFSET 1 | 48 LIMIT 2 OFFSET 1 |
50 } | 49 } |
51 } [lrange $result 2 5] | 50 } [lrange $result 2 5] |
52 do_test select8-1.3 { | 51 do_test select8-1.3 { |
53 execsql { | 52 execsql { |
54 SELECT DISTINCT artist,sum(timesplayed) AS total | 53 SELECT DISTINCT artist,sum(timesplayed) AS total |
55 FROM songs | 54 FROM songs |
56 GROUP BY LOWER(artist) | 55 GROUP BY LOWER(artist) |
57 LIMIT -1 OFFSET 2 | 56 LIMIT -1 OFFSET 2 |
58 } | 57 } |
59 } [lrange $result 4 end] | 58 } [lrange $result 4 end] |
60 | 59 |
61 | 60 |
62 finish_test | 61 finish_test |
OLD | NEW |