squirrel icon indicating copy to clipboard operation
squirrel copied to clipboard

Support for JOIN in DELETE or UPDATE

Open alupuleasa opened this issue 4 years ago • 2 comments

How can I generate a query like this using https://github.com/Masterminds/squirrel:

DELETE m 
FROM   mainschema.maintable AS m 
       LEFT JOIN (SELECT stagingid 
                  FROM   stagingschema.stagingtable 
                  WHERE  versionid= ?) AS s 
              ON m.mainid = s.stagingid 
WHERE  m.id = id
       AND s.stagingid IS NULL 

I'm asking this because

https://github.com/Masterminds/squirrel/blob/master/delete.go

doesn't have a LeftJoin method like

https://github.com/Masterminds/squirrel/blob/master/select.go#L298

alupuleasa avatar Jul 30 '20 12:07 alupuleasa

Any updates on this?

beeekind avatar Oct 07 '20 21:10 beeekind

This would be useful!

Kegley avatar Dec 01 '20 19:12 Kegley