Given a table with the following structure:
CREATE TABLE transitions (id INT, ordering INT, item_id INT, action_id INT)
Is it possible to get ClojureQL to generate a query like this one:
SELECT a.item_id, a.action_id
FROM transitions a
WHERE a.ordering = (SELECT MAX(b.ordering)
FROM transitions b
WHERE b.item_id = a.item_id
)
This will return many rows, one for each item, indicating that item's latest transition.
I've been looking at using join
, but worry I might hit this bug: https://github.com/LauJensen/clojureql/issues/114