This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-07
Channels
- # aleph (4)
- # announcements (9)
- # babashka (44)
- # beginners (6)
- # cider (8)
- # clj-kondo (5)
- # clojars (10)
- # clojure (10)
- # clojure-berlin (1)
- # clojure-dev (9)
- # clojure-europe (20)
- # clojure-gamedev (1)
- # clojure-miami (2)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (5)
- # clojurescript (12)
- # conjure (1)
- # cursive (19)
- # data-science (2)
- # datahike (10)
- # etaoin (5)
- # events (3)
- # fulcro (14)
- # gratitude (2)
- # honeysql (8)
- # humbleui (1)
- # hyperfiddle (60)
- # introduce-yourself (7)
- # jobs-discuss (27)
- # juxt (2)
- # kaocha (7)
- # lsp (23)
- # malli (9)
- # missionary (2)
- # off-topic (48)
- # pathom (24)
- # releases (1)
- # shadow-cljs (256)
- # sql (46)
- # xtdb (19)
I’m trying to write a query like:
(select * from table_1 limit 10 order by x) union all (select * from table_1b limit 10 order by x) limit 10 order by x
but am not able to get honey to “group” the selects in parens so i can get limit applied before and after the union
I made it work using CTEs, but that should not really be necessary(sql/format {:union-all [{:nest {:select :*}}
{:nest {:select :*}}]
:limit [:inline 10]})
=> ["(SELECT *) UNION ALL (SELECT *) LIMIT 10"]
Happy to update the docs to make that easier to figure out, if you have suggestions. The :union-all
docs mention :nest
https://cljdoc.org/d/com.github.seancorfield/honeysql/2.5.1103/doc/getting-started/sql-clause-reference#intersect-union-union-all-except-except-all (but don't provide an example).