Bad query: SELECT a.username, a.year, a.description, a.amount, b.first_name, b.surname, c.title as department_title, d.title as title_title FROM old_grants a LEFT JOIN user_info_list b ON a.username = b.username LEFT JOIN department_list c ON b.department = c.department_id LEFT JOIN title_list d ON b.title = d.title_id WHERE award_type LIKE '%cor%' AND year = 2012 ORDER BY date DESC : Unknown column 'date' in 'order clause'