Hi,

I wonder is there a way to generate a query with joins with more than one 
condition? For example:

SELECT o.id FROM object
JOIN object_value AS ov1 ON ov1.o_id=object.id AND ov1.field_id=1 AND 
ov1.value=2
JOIN object_value AS ov2 ON ov2.o_id=object.id AND ov2.field_id=2 AND 
ov2.value>=1
JOIN object_value AS ov3 ON ov3.o_id=object.id AND ov3.field_id=3 AND 
ov3.value>=2

It's supposed to find all objects that have all fields with corresponding 
values. 

Does anybody know how to code that in the frame of Django ORM. Or the only 
solution is to go down to SQL?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Lc4jgs4Y_RIJ.
To post to this group, send email to django-users@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