I have the following query:
SELECT services.name as Service, services.logo_name as Logo, packages.name as Package
FROM `client_services`
INNER JOIN services ON service_id = services.id
INNER JOIN packages ON packages.id = package_id
WHERE client_id = 1
ORDER BY services.sort_id
Well in client_services I have 5 results that need to be shown. 2 of them are NULL for package_id. When I run the query, it only shows 3 results, the ones that have a set package_id.
If there is no package, I just want it to show up blank, but the rest of the information is important so I still need the record to show.
Do I need to change anything in my query to get that to work?
Thanks!
change one line:
LEFT JOIN packages ON packages.id = package_id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With