Hi;

I've posted a diagram of what I'm trying to explain here:
http://www.hinde.net/images/queryquestion.png

I'm working on a tool for a screen printer. Products (t-shirts, hats,
etc.) can be linked to multiple categories.

A product can come in multiple colors and each color can come in a
variety of sizes.

What I want is a list of potential sizes that could be in a category.

(this is a migration from another system, so the field names aren't
all djangonic)

This is the sql I've come up with, I'm curious how one would express
it in the orm...

Select distinct(size.size) from size

                inner join productcolorsize pcs
                     on size.id = pcs.size_key

                inner join productcolor pc
                        on pcs.product_color_key = pc.id

                inner join product p
                        on pc.product_key = p.id

                inner join product_product_category ppc
                        on p.id = ppc.product_id

                where ppc.category_id = 1  order by size.sortorder


Thanks, in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to