diff --git a/docs/devlog.md b/docs/devlog.md index 136b4b9e..59a15bec 100644 --- a/docs/devlog.md +++ b/docs/devlog.md @@ -65,4 +65,22 @@ Screenshot for comparison, although the index I'm using is a few months old: You can use this command to get names, versions, and ids all at once: ```sqlite select distinct ids.id, manifest.id, versions.version, manifest.version, names.name, manifest.name from ids, manifest, versions, names where manifest.id = ids._rowid_ and manifest.version = versions._rowid_ and manifest.name = names._rowid_ order by ids.id; +``` + +## Update 10/5/2020 + +At this point, I'm trying to see if it's possible to get the latest version, and this code doesn't work even though it should. This is based on the code from https://www.sqlitetutorial.net/sqlite-window-functions/sqlite-last_value/#:~:text=The%20LAST_VALUE%20%28%29%20is%20a%20window%20function%20that,LAST_VALUE%20%28expression%29%20OVER%20%28%20PARTITION%20BY%20expression1%2C%20expression2%2C + +```sqlite +SELECT DISTINCT + ids.id, manifest.id, versions.version, manifest.version, names.name, manifest.name, + LAST_VALUE ( manifest.version ) OVER ( + ORDER BY ids.id + RANGE BETWEEN UNBOUNDED PRECEDING AND + UNBOUNDED FOLLOWING + ) AS NewestVersion +FROM + ids, manifest, versions, names +WHERE + manifest.id = ids._rowid_ and manifest.version = versions._rowid_ and manifest.name = names._rowid_; ``` \ No newline at end of file