Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility issues #6

Open
Consulting4J opened this issue Sep 8, 2022 · 0 comments
Open

Compatibility issues #6

Consulting4J opened this issue Sep 8, 2022 · 0 comments

Comments

@Consulting4J
Copy link

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant