Latest Document Versions
From documents(document_id, version, content), return document_id, version and content for the highest version of each document, ordered by document_id.
Examples
EXAMPLE WALKTHROUGHlatest versions
A guided view of the published example, not a trace of your code.
INPUT
["CREATE TABLE documents(document_id INT,version INT,content TEXT); INSERT INTO documents VALUES(1,1,'old'),(1,2,'new'),(2,1,'only');"]TASKquery()
EXPECTED OUTPUT
[[1,2,"new"],[2,1,"only"]]Start with the input values shown in this example.
Input: CREATE TABLE documents(document_id INT,version INT,content TEXT); INSERT INTO documents VALUES(1,1,'old'),(1,2,'new'),(2,1,'only');
Output: [[1,2,"new"],[2,1,"only"]]
Explanation: latest versions
Hint 1
Check column aliases and required ordering.