honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
2020-05-11T22:37:27.021500Z

Is there a way to alias a subquery?

(SELECT MAX(product_id)
 FROM products p2
 WHERE p1.product_id = p2.product_id) subquery2

2020-05-11T22:37:59.022100Z

the subquery above has been aliased to subquery2

seancorfield 2020-05-11T23:05:59.022500Z

@dcj What is that context for how that is used?

seancorfield 2020-05-11T23:07:55.023300Z

user=> (-> (select :*) (from [(-> (select :*) (from :foo)) :a]) (h/format))
["SELECT * FROM (SELECT * FROM foo) a"]
user=> 
An aliased thing is just a pair with the thing in the first slot and the alias in the second slot.