我收到以下代码的错误,它没有获取任何行:
type User struct {
Id int
Username string
Name string
Age int
}
type Salory struct {
Id int
Username string
Salory string
Reamrk string
}
var detail []*models.Salory
if num, err := orm.NewOrm().Raw("SELECT salory.id, salory.salory, salory.reamrk, salory.username, user.username, user.name FROM salory LEFT JOIN user ON salory.username = user.username ORDER BY id ASC",).QueryRows(&detail);
err == nil {
fmt.Printf("%d Total rows read\n", num)
for _, post := range detail {
fmt.Printf("Id: %d, UserName: %d, Name: %s\n", post.Id, post.Salory.Username, post.Remark)
}
}
我想知道使用Raw SQL查询
的Beego中的Left Join概念