This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-12
Channels
- # architecture (17)
- # babashka (13)
- # beginners (12)
- # calva (1)
- # cider (7)
- # clojure-bay-area (15)
- # clojure-europe (4)
- # clojure-norway (7)
- # datomic (7)
- # gratitude (5)
- # honeysql (7)
- # hyperfiddle (2)
- # introduce-yourself (4)
- # jobs-discuss (13)
- # juxt (2)
- # lsp (3)
- # malli (7)
- # practicalli (17)
- # rdf (8)
- # re-frame (9)
- # releases (1)
- # shadow-cljs (24)
- # spacemacs (15)
Hi I have the following data query:
{:select [:*],
:from [:definition],
:full-join [:note [:= :note/definition-id :definition/definition-id]],
:join
[[:author :note-author] [:= :note/author-id :note-author/author-id]]}
and its producing the following sql:
SELECT *
FROM definition
INNER JOIN author AS note_author ON note.author_id = note_author.author_id
FULL JOIN note ON note.definition_id = definition.definition_id
What should I do to make the inner join appear after the full join?✅ 2
Ow wow I just read about :join-by
in the docs
{:select [:*],
:from [:definition],
:join-by
[:full
[:note [:= :note/definition-id :definition/definition-id]]
:join
[[:author :note-author] [:= :note/author-id :note-author/author-id]]]}
This solves my problemYup, not all databases care about join order but some do -- so :join-by
was added for those "sensitive" databases 🙂
(I mean, SQL is relational so order absolutely should not matter)
Yeah looks like postres is a bit more sensitive 😆
Thanks a lot for all your work on this, this is a incredible library together next-jdbc it's super powerfull