I'm trying to select two groups of countries with different situations.
SELECT cou.id, cou.title FROM continents con RIGHT OUTER JOIN countries cou ON con.id = cou.continents_id WHERE con.deliver = 1 AND con.active = 1 UNION ALL SELECT cou2.id, cou2.title FROM countries cou2 LEFT OUTER JOIN continents con2 ON con2.id = cou2.continents_id WHERE cou2.deliver = 1 AND con2.deliver = 0 - Continent has to be
deliver = 1and then select all countries inside it. - If Continent is
deliver = 0but there are countries withdeliver = 1inside, then select it.
What is the best way of doing this?