zql icon indicating copy to clipboard operation
zql copied to clipboard

Compatibility issues

Open Consulting4J opened this issue 2 years ago • 0 comments

This is an amazing project, unfortunately it seems that this project is lack of maintaining and improvement. I found some issues for the normal SQL parsing, such as :

CREATE TABLE IF NOT EXISTS docs ( id int(6) unsigned NOT NULL, rev int(3) unsigned NOT NULL, content varchar(200) NOT NULL, PRIMARY KEY (id,rev) ) DEFAULT CHARSET=utf8;

INSERT INTO docs (id, rev, content) VALUES ('1', '1', 'The earth is flat'), ('2', '1', 'One hundred angels can dance on the head of a pin'), ('1', '2', 'The earth is flat and rests on a bull's horn'), ('1', '3', 'The earth is like a ball.');

SELECT a.id, a.rev, a.content FROM docs a INNER JOIN ( SELECT id, MAX(rev) rev FROM docs GROUP BY id ) b ON a.id = b.id AND a.rev = b.rev;

SELECT a.* FROM docs a LEFT OUTER JOIN docs b ON a.id = b.id AND a.rev < b.rev WHERE b.id IS NULL;

Consulting4J avatar Sep 08 '22 23:09 Consulting4J