can someone help me to translate the following sql snippet into plain honeysql query:
with grants as
(select * from grants_table
where (user_id = 'foo'))
select * from grants
I know how to write something like:
:select :* :from :grants-table
:where [:= :user-id "foo"]
But I can’t make it work with “with as”I think I figured it out, it’ll be something like:
:with [[:grants {:select [:*] :from [:grants-table] :where [:= :user-id "foo]}]]
:select :* :from :grants
Ah. Now I’m struggling with the following construct:
select (case
when ( count(*) < 0 ) then 'yes'
else 'no'
end)
from my_table
how do you write this in Honey?ah, seems it involves using sql/call