Re: Comparing ManyToMany fields

2009-12-27 Thread Scott Maher
akaariai wrote: > This is not the easiest query to perform using SQL. Something like the > following query might work, I have tested it only quickly. > > select t2.pizza_id > from (select pizza_id from pizza_toppings group by pizza_id >having count(*) = (select count(*) from pizza_toppings wher

Re: Comparing ManyToMany fields

2009-12-27 Thread akaariai
On 27 joulu, 11:32, Scott Maher wrote: > Is it possible to filter by the ManyToMany fields? > > Suppose I have a Pizza model and a Topping model. Topping has a > ManyToManyField pointing to Pizza. I now have an instance of a Pizza > called mypizza. > > I would like to now search for all Pizzas w

Re: Comparing ManyToMany fields

2009-12-27 Thread Michael Jenkinson
Hi a pizza has a one to many relationship with its topping. in a list of pizzas there could be some that have the same topping, like thick, thin etc. the query would look like select pizza from pizzas where topping = xyz cheers michael - Original Message From: Scott Maher To: dj