-->
Search here and hit enter....

Gorm, Join 2 Query terpisah menjadi satu table

var stats []entity.UCRProductStat dbStat := repo.db.Table("ucr_product_stats"). Select("product_id,COALESCE(SUM(stat_value),0) as stat_value "). Where("stat_name = ? ", "tertarik"). Group("product_id").Scan(&stats) err := repo.db. Where("ucr_products.agent_id IN ? "+ "AND ucr_products.latest_status = ? "+ "AND ucr_products.created_at > ? "+ "AND ucr_products.slug like ? ", userIds, constant.ContextDalamProspekMCC, last24Hours, search). Joins("Type"). Joins("Stat", dbStat). Preload("Images"). Order(by). Scopes(paging). Find(&products). Error
BERIKAN KOMENTAR ()