Masterminds / squirrel

Fluent SQL generation for golang
Other
6.88k stars 465 forks source link

UPDATE with FROM statement #291

Open bohrasankalp opened 3 years ago

bohrasankalp commented 3 years ago

Any example where from could be used with update query.

update albums
set num = jsonb_set(num, '{folders}', to_jsonb(coalesce(sq.counts, 0)), false)
from (select s.album_id, COUNT(s.album_id) as counts
            from file_system s
            where is_dir = true
            group by s.album_id
            order by s.album_id) as sq
where albums.id = sq.album_id;
officialgupta commented 2 years ago

has there been any update on this?

ysomad commented 2 years ago

has there been any update on this?

I don't think so, I have the same question.