0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-12 15:33:44 +00:00
libsql/libsql-wal/tests/assets/fixtures/tkt-868145d012.test
ad hoc ad79ef48a2
libsql wal tests (#1408)
* add tests

* add bench
2024-05-24 13:59:17 +00:00

45 lines
773 B
Plaintext

CREATE TABLE p (
id INTEGER PRIMARY KEY,
uid VARCHAR(36),
t INTEGER
);
CREATE TABLE pa (
id INTEGER PRIMARY KEY,
a_uid VARCHAR(36)
);
CREATE TABLE a (
id INTEGER PRIMARY KEY,
uid VARCHAR(36),
t INTEGER
);
INSERT INTO pa VALUES(1,'1234');
INSERT INTO pa VALUES(2,'2345');
INSERT INTO p VALUES(3,'1234',97);
INSERT INTO p VALUES(4,'1234',98);
INSERT INTO a VALUES(5,'1234',98);
INSERT INTO a VALUES(6,'1234',99);
SELECT DISTINCT pa.id, p.id, a.id
FROM
pa
LEFT JOIN p ON p.uid='1234'
LEFT JOIN a ON a.uid=pa.a_uid
WHERE
a.t=p.t
;
SELECT DISTINCT pa.id, p.id, a.id
FROM
pa
LEFT JOIN p ON p.uid='1234'
LEFT JOIN a ON a.uid=pa.a_uid AND a.t=p.t
ORDER BY 1, 2, 3
;