Order By Date desc evaluates 01-01-1970 higher then everything else

I have the following simplified query SELECT id to_char(execution_date, ‘YYYY-MM-DD’) as execution_date FROM schema.values ORDER BY execution_date DESC, id DESC execution_date can be null. If no value is present in execution_date it will be set to 1970-01-01 as default. My problem is, that the following table values will lead to a result where 1970-01-01 is… Read More Order By Date desc evaluates 01-01-1970 higher then everything else

SQL Query, What have I done wrong? I am fairly new to mySQL

Solution problem SELECT agency_name, Count(*) AS complaint_type_count FROM service_request_xs GROUP BY agency_name ORDER BY Count(*) DESC; solution uploaded >Solution : You have to tell the count() function what to count. You can insert an individual column, or * for all of it etc. But you have to count something. This is a fiddle, showing how… Read More SQL Query, What have I done wrong? I am fairly new to mySQL