gorm icon indicating copy to clipboard operation
gorm copied to clipboard

preload的数据需要join

Open smile-kindred opened this issue 2 years ago • 0 comments

Your Question

第三层数据需要left join 另外一张表sku,拿到若干字段放到line,这个join和select该怎么写,折腾了几天了,没找到解决办法 db.Preload("Pos.Lines").Joins("LEFT JOIN sku ON sku.id = line.sku_id").Select("select name from sku as sku_name").Find(&biz_data)

The document you expected this should be explained

Expected answer

smile-kindred avatar Jun 19 '22 10:06 smile-kindred