+----+---------+-----------+---------------------+-----------+-----------+
| id | user_id | foo_id | created_at | active |type |
+----+---------+-----------+---------------------+-----------+-----------+
| 1 | 1 | 1 | 2011-05-10 13:12:35 | 1 | 2 |
| 7 | 5 | 2 | 2011-05-10 14:45:04 | 1 | 1 |
| 4 | 4 | 2 | 2011-05-10 13:24:45 | 1 | 2 |
| 8 | 6 | 2 | 2011-05-16 14:53:03 | 1 | 1 |
| 9 | 7 | 2 | 2011-05-16 14:55:11 | 1 | 0 |
+----+---------+-----------+---------------------+-----------+-----------+
Это UserMapper
модель в Django.Я хочу написать запрос так:
Получить все user_id, чей foo_id = 2 and type=0
и все результаты user_id = 6;
Скажи;
select * from table where user_id = 6 and (foo_id=2 and type=6) // Such sort of query
Как я могу сделать в наборе запросов Django..