Reputation: 2554
I want to make a specific odrer of WHERE statements in my query to use multicolumn index in database. But oder in code is not the same as result query: code:
filter(user=self.user, province=self.province, city=self.city)
Mysql result:
WHERE (`accounts_usercity`.`province_id` = 6 AND `accounts_usercity`.`city_id` = 32 AND `accounts_usercity`.`user_id` = 26 )
How to force my own order?
Upvotes: 1
Views: 110
Reputation: 3394
If you chain the filters it should work:
filter(user=self.user).filter(province=self.province).filter(city=self.city)
I tried it in django 1.2.5 and it's working.
Upvotes: 2