MySQL Joins are not supported while Updating - Join statement is missing

    return campaign, tx.
        Debug().
        Model(campaign).
        Joins("LEFT JOIN portfolios ON portfolios.id = campaigns.portfolio_id").
        Where("portfolios.authentication_id = ?", parentId.String()).
        Updates(updateIndex).
        Error`
UPDATE `campaigns` SET `acos_goal`=50,`updated_at`='2022-11-28 11:54:31.697' WHERE portfolios.authentication_id = 'afe86891-86f6-4710-b9b0-c50792af8a44' AND `id` = 'aa65a014-9470-4be3-9bf7-83720c147417'

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: loeffel-io

any information here @jinzhu? 🙏

Comment From: loeffel-io

bump

Comment From: Nomango

Same issue

Comment From: loeffel-io

bump <3

Comment From: nybblex

a little workaround specifying join conditions, 'set' and 'where' in a raw query and repeating them on the update sentence

q := "update table1 t1 "
q += "left join table2 t2 on t2.field_a = t1.field_b "
q += "set t1.field_x = ? "
q += "where t2.field_y = ? "

db.Raw(q, foo, bar).Where("t2.field_y = ?", bar).Updates(map[string]interface{}{"t1.field_x": foo})

Comment From: dhalturin

https://github.com/go-gorm/gorm/issues/4248#issuecomment-1986139639

Comment From: loeffel-io

#4248 (comment)

this do not look like a clean solution imo @jinzhu

Comment From: mtsoltan

I'd like for this to be re-opened if possible. It is still an issue to the best of my knowledge.

Comment From: In-July

Have a solution?

Comment From: Alex41

bump <3