Skip to content
Advertisement

Tag: many-to-many

Get Rows that are include one many to many. but not another

I am having a little trouble with this query. I want to filter my Features down for all features that have applicabilities that have include the name ‘G6’, but that also do not have a many to many relationship with applicabilies that have the name ‘n2’. I have right now: I have a many to many from Feature to Applicability

Django many-to-many: Best way to get elements in one related query set but exclude elements in other related query sets?

Consider these related models: In a view, I need to query to get all Bs related to a given A while excluding all Bs related with a set of other As. I need the grey area: My current, grossly inefficient approach is as follows: In my application, previous_As could have nearly 1,000 elements, which makes this approach extremely expensive. Is

Pairing table query

I was wondering how I construct a query to get all articles with all their information, and for every article a list with their tags. I used a pairing table called ArticleTags to connect Article and Tags. Can anyone tell me what the query would be if I wanted to receive all articles along with their tags per article. My

Advertisement