I have a SQL command in PHP as follows:
UPDATE tbl1 AS A,tbl2 AS B SET A.field1 = '1' WHERE A.field2=B.field2 AND B.field3 = {$var};
I need to write the command in golang using gorm package and this is what I am trying:
db.Table("tbl1 as A").Joins("INNER JOIN tbl2 B on A.field2 = B.field2").Where("B.field3 = ?", var).Update("A.field1", "1")
But in the terminal, this query is being interpreted as :
UPDATE tbl1 as A SET `A`.`field1`='1' WHERE tbl2.person_id = var
How do I frame the gorm query properly? I dont want to use db.Exec() or db.Raw() and I dont have the structure for the two tables. Any help would be appreciated