Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多对多时,如何使用left join进行多表连接 #853

Open
wpliang opened this issue Aug 24, 2020 · 0 comments
Open

多对多时,如何使用left join进行多表连接 #853

wpliang opened this issue Aug 24, 2020 · 0 comments

Comments

@wpliang
Copy link

wpliang commented Aug 24, 2020

type Post struct {
Id int
Title string
User *User orm:"rel(fk)"
Tags []*Tag orm:"rel(m2m)"
}
type Tag struct {
Id int
Name string
Posts []*Post orm:"reverse(many)"
}
var posts []*Post
num, err := dORM.QueryTable("post").Filter("Tags__Tag__Name", "golang").All(&posts)
像这样的查询,都是inner join 连接的,如果能用left join 连接呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant