mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-15 07:29:41 +00:00
ad79ef48a2
* add tests * add bench
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
|
|
create table t_distinct_bug (a, b, c);
|
|
insert into t_distinct_bug values ('1', '1', 'a');
|
|
insert into t_distinct_bug values ('1', '2', 'b');
|
|
insert into t_distinct_bug values ('1', '3', 'c');
|
|
insert into t_distinct_bug values ('1', '1', 'd');
|
|
insert into t_distinct_bug values ('1', '2', 'e');
|
|
insert into t_distinct_bug values ('1', '3', 'f');
|
|
|
|
|
|
select a from (select distinct a, b from t_distinct_bug)
|
|
|
|
|
|
CREATE VIEW v42b AS SELECT DISTINCT a, b FROM t_distinct_bug;
|
|
SELECT a FROM v42b;
|
|
|
|
|
|
select a, udf() from (select distinct a, b from t_distinct_bug)
|
|
|
|
|
|
CREATE TABLE x1(a);
|
|
CREATE TABLE x2(b);
|
|
CREATE TABLE x3(c);
|
|
CREATE VIEW vvv AS SELECT b FROM x2 ORDER BY 1;
|
|
|
|
INSERT INTO x1 VALUES('a'), ('b');
|
|
INSERT INTO x2 VALUES(22), (23), (25), (24), (21);
|
|
INSERT INTO x3 VALUES(302), (303), (301);
|
|
|
|
|
|
CREATE TABLE x4 AS SELECT b FROM vvv UNION ALL SELECT c from x3;
|
|
SELECT * FROM x4;
|
|
|
|
|
|
SELECT * FROM x1, x4
|
|
|
|
|
|
SELECT * FROM x1, (SELECT b FROM vvv UNION ALL SELECT c from x3) ORDER BY 1,2;
|
|
|