I have the following mysql query:
SELECT merchantNames.strippedName,merchantNames.lastCached,merchantNames.id FROM merchantNames JOIN autoCoupons ON merchantNames.rawName = autoCoupons.merchantName WHERE NOW() > autoCoupons.startDate AND autoCoupons.startDate > merchantNames.lastCached OR NOW() > autoCoupons.endDate AND autoCoupons.endDate > merchantNames.lastCached OR NOW() > autoCoupons.timeAdded AND autoCoupons.timeAdded > merchantNames.lastCached OR merchantNames.lastCached < NOW() - INTERVAL 2 DAY GROUP BY merchantNames.strippedName ORDER BY merchantNames.pageviews DESC How do I set this query to order the results in such a way that those that meet the first three lines of the WHERE clause criteria are at the top and those that only meet the bottom line are at the bottom?