This is the table (model) setup: [county] (list of counties) [office] (list of offices) [active counties] (a relational table with a county_id, office_id and 'active' column) [division] (columns: 'name', 'county_id' which points to the first county table)
Obviously the division table is directly linked to the county table which is just a list of names. What I need to do is extract the divisions for a particular office, based on the active counties table. The problem is, 'active counties' is not directly linked to divisions! This is how I would do it in sql, assuming the current office has an id of '3': SELECT d."name" FROM division d LEFT JOIN active_counties c ON (d.county_id=c.county_id) WHERE c.office_id='3' I'm hoping to avoid a custom SQL query from django, but right now I'm not seeing any alternatives. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---