Left Join With Where Clause

I need to retrieve all default settings from the settings table but also grab the character setting if exists for x character. But this query is only retrieving those settings where character is = 1, not the default settings if the user havent setted anyone. SELECT `settings`.*, `character_settings`.`value` FROM (`settings`) LEFT JOIN `character_settings` ON `character_settings`.`setting_id` … Read more

SQL – HAVING vs. WHERE

I have the following two tables: 1. Lecturers (LectID, Fname, Lname, degree). 2. Lecturers_Specialization (LectID, Expertise). I want to find the lecturer with the most Specialization. When I try this, it is not working: SELECT L.LectID, Fname, Lname FROM Lecturers L, Lecturers_Specialization S WHERE L.LectID = S.LectID AND COUNT(S.Expertise) >= ALL (SELECT COUNT(Expertise) FROM Lecturers_Specialization … Read more