I have a MySql database with 2 tables:
countries
results
- Countries is just and
idand acountry name. - Results is a
country_id, avalueand adate. - Not all countries have results on each date.
How can I create a query that lists all countries with their specific result, but still list them and shows 0 if there is no result on the results table?
Use a LEFT JOIN between the two tables
To show 0 (for the
valuecolumn) if there is no result, use IFNULL.