1
llhbc
5y

Hi people, I need some help.
First, stack , Golang/gorm(ORM)
I need doing a simple sum(amount) , I have a " db.Table("orders").Select("sum(amount) as Amount, merchants.name").Joins("inner join merchants on merchants.id = orders.merchant_id AND merchants.name = ? GROUP BY merchants.name", key).Scan(&total)

total is a struct type .

Are there any smell and I don't see ....?

Comments
  • 1
    As long as total is a slice of maps, and you check it, you should be good.
Add Comment