+ 1

Have SQL LEFT joins problem I could use help on

Have SQL problem I can't figure out help please: From the specialist table need to retrieve the first and last name and contact number of those that provide care for the penguins from the species table. You can see snapshot of the tables/columns here: https://www.dropbox.com/s/m6f3591u1kurart/Screenshot%202018-10-11%2014.37.20.png?dl=0 Here is what i I tried... SELECT tbl_specialist.specialist_fname, tbl_specialist.specialist_lname, tbl_specialist.specialist_contact FROM tbl_specialist LEFT JOIN tbl_care ON tbl_specialist.specialist_id=tbl_care.care_specialist LEFT JOIN tbl_species ON tbl_care.care_id = tbl_species.species_care WHERE tbl_species.species_name = "penguin"; Any help is greatly appreciated!

11th Oct 2018, 9:33 PM
Mario
Mario - avatar
3 Respuestas
+ 3
Why do you use a left join instead of an inner join for the tables? You have a where clause, which makes only sense, when you have a complete record containing data from all three tables.
13th Oct 2018, 10:19 PM
P.W.R.
P.W.R. - avatar
+ 2
Hi, Turns out the only issue was that I had double instead of single quotes around penguin. The WHERE filter is required because I just needed those that care for the penguins. Thank you for taking a sec to look at this, much appreciated.
23rd Oct 2018, 9:29 PM
Mario
Mario - avatar