I'm trying to sort two date columns in the table, FinalReviewDate, and DateDelivered. Any column with a DateDelivered is always going to have a FinalReviewDate that preceeds it, but a project can have a FinalReviewDate without having a DateDelivered. I used ASC to ORDER BY for both columns and received this result.
Final Review Date Date Delivered
NULL NULL
NULL NULL
xxxx-xx-xx xxxx-xx-xx
xxxx-xx-xx NULL
How can I ORDER BY so my result looks like this instead?
Final Review Date Date Delivered
NULL NULL
NULL NULL
xxxx-xx-xx NULL
xxxx-xx-xx xxxx-xx-xx
I don't know how to factor in the NULL values so they're included when I ORDER BY both tables. Here's the code I'm using.
$sql = "SELECT Project, Client, DateReceived, LastName, FinalReviewDate, DateDelivered FROM Projects
WHERE DateAccepted IS NULL
ORDER BY FinalReviewDate ASC, DateDelivered ASC";
$result = $conn->query($sql);