#3592: Allowing Q Objects to select between OUTER and INNER joins (semi-
intelligently)
--------------------------------+-------------------------------------------
   Reporter:  [EMAIL PROTECTED]     |                Owner:  adrian             
   
     Status:  new               |            Component:  Database wrapper      
    Version:  SVN               |           Resolution:                        
   Keywords:  Q,QuerySet,JOINs  |                Stage:  Design decision needed
  Has_patch:  1                 |           Needs_docs:  0                     
Needs_tests:  1                 |   Needs_better_patch:  1                     
--------------------------------+-------------------------------------------
Comment (by anonymous):

 (sorry I forgot to block quote...)
 Some more things:
 
 I realized that the correct way to do ORing is by use of UNION. For
 example, if I have three models: X, Y, and Z (each with parameters a,b,c)
 and both Y and Z foreign key to X: Z --> X and Y --> X. Then: (They are
 all in app `package')
 
 Q(yaisnull = False) | Q(zbisnull = False)
 should yield the following query:
 
 (approximate)
 {{{
 SELECT * FROM package_x
     INNER JOIN "package_y" AS "package_xy" ON
         package_x.id = package_xy.x_id
             WHERE package_xy.a IS NOT NULL
 UNION
 SELECT * FROM package_x
     INNER JOIN "package_z" AS "package_xz" ON
         package_x.id = package_xz.x_id
             WHERE package_xz.b IS NOT NULL
 }}}
 
 Is this clear? Unfortunately, it would take some rewriting of django to
 even attempt this.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3592#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to