>>>> 2012/06/20 14:32 -0700, Rick James >>>>
(
   SELECT ruid1, ruid2, overlap FROM l4_link WHERE ruid1=xxx
   UNION
   SELECT ruid1, ruid2, overlap FROM l4_link WHERE ruid2=xxx
) ORDER BY overlap DESC;

Make it UNION ALL or UNION DISTINCT depending on whether xxx can be in both 
fields of one row.  UNION DISTINCT makes a pass over the temp table to dedup.
<<<<<<<<
The help example shows a UNION s each SELECT separatly round-bracketed,
    (SELECT ruid1, ruid2, overlap FROM l4_link WHERE ruid1=xxx)
    UNION
    (SELECT ruid1, ruid2, overlap FROM l4_link WHERE ruid2=xxx)
  ORDER BY overlap DESC
but bracketing both is not mentioned. What is the difference?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to