is there a way where I can return 0 if i get an empty result in mysql?
SELECT t1.amount as Amt
FROM table1 as t1
INNER JOIN table2 as t2
ON t1.project_id = t2.id
WHERE t2.proj_name = "Project_Kalinga"
AND t1.date_sent = (SELECT MAX(date_sent) FROM table WHERE project_id = "0123")
Currently for the project name 'Project Kalinga' I get an empty result.
Is there a way where from this query even if i get an empty result, I'll just get 0 instead? So then the output would be like
| Amt |
| 0 |
Thank You!
Here's the sqlfiddle