Unsure on how to link tables
So far my code works as expected however I need to display the first_name and last_name associated with the contact_id.
So youd have to link Customer.Contact_id to Caller.Caller_id then get the first and last name of the contact_id, however im unsure how to implement this into my code. Any help is appreciated.
https://imgur.com/a/5to8c - How the tables link together
SELECT Company_name, COUNT(Company_name) as nc FROM Customer JOIN Caller ON Customer.Company_ref = Caller.Company_ref JOIN Issue ON Caller.Caller_id = Issue.Caller_id GROUP by Company_name HAVING COUNT(Company_name) < 5
If you need the count of elem based on customer name the perform lower tha 5 you could use this
SELECT Caller.first_name , Caller.last_name, COUNT(*) as nc FROM Customer JOIN Caller ON Customer.contacn_id = Caller.caller_id JOIN Issue ON Caller.Caller_id = Issue.Caller_id GROUP by Customer.first_name , Customer.last_name HAVING COUNT(*) < 5