mysql - How do I convert this SQL command from PHP to golang(gorm)?

one text

I have a SQL command in PHP as follows:

SELECT A.field1 FROM table AS A, field2 AS B WHERE A.field3=B.field3 AND B.field4 = {$var}";

I have to rewrite this in golang using gorm package and this what I have come up with.

rows, _ := db.Table("table").Select("A.field1 AS A, field2 AS B").Where("B.field4 = ?", var).Rows()

Is this correct? How can I write it properly?

Source