Need to Select rows with null values in one column first
ti3rFeb 8 2013 — edited Feb 8 2013I have a table for advertising leads where the Last_Mailed_Date is often null, meaning the individual has never been sent advertising. If I query for leads that have never been mailed (is null) or who have not been mailed within 60 days, it always returns the is null rows last, so depending on number I request, I may never get the "is null" records at all. We want to pull the "is null" rows first because they have never received advertising from us before. I can't find any way to change the order of how the records are selected. Bottom line, I want to pull records with the null values first, then if I need more records, pull with the specified date requirements for last mailed.
select *
from T3_LEADS
WHERE
Last_Mailed_Date IS NULL OR (SYSDATE - Last_Mailed_Date) > 60)