How to group by in a ManyToMany relationship #331
Unanswered
guilhermeaiolfi
asked this question in
Q&A
Replies: 1 comment
-
I see no other way out of this situation than to normalize database tables. But if |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I've been away from using CycleORM for a while, so I am a little bit slow at its concepts and how to use it properly. So the problem I am facing is the following: imagine the user -> tag scenario that we have in the documentation, but with another relationship, something like
company_id
. So that many-to-many table would have: id, tag_id, user_id, company_id. If I use this schema for the Company relations to get all tags used in a company:It works, but it brings duplication for every entry that is repeated through users. I would need some way to use distinct or group by in that relationship.
BTW, I am using cycle 1.x. Thank you for any help.
Beta Was this translation helpful? Give feedback.
All reactions