ianhaney
12-30-2015, 09:03 PM
Hi
I am having some trouble with SQL JOINS as always got bit confused by them and if to use JOIN, LEFT JOIN etc
I am trying to get id, ref, role from jobs table and id, name from employers table cause employers add jobs from a form into a db and I want to display the jobs they add on their profile page so they can edit the job advert or delete the job advert once filled
Hope that makes sense
Below is SQL query I have so far
SELECT j.id, j.ref, j.role, j.division, j.location, j.salary, j.description FROM jobs AS j LEFT JOIN `employees` AS e.id = j.id
I get the following error though on the employer-profile.php page
Warning: mysqli::query(): (42000/1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id = j.id' at line 1 in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/security-site/employer-profile.php on line 60 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id = j.id' at line 1
Thank you in advance
Ian
I am having some trouble with SQL JOINS as always got bit confused by them and if to use JOIN, LEFT JOIN etc
I am trying to get id, ref, role from jobs table and id, name from employers table cause employers add jobs from a form into a db and I want to display the jobs they add on their profile page so they can edit the job advert or delete the job advert once filled
Hope that makes sense
Below is SQL query I have so far
SELECT j.id, j.ref, j.role, j.division, j.location, j.salary, j.description FROM jobs AS j LEFT JOIN `employees` AS e.id = j.id
I get the following error though on the employer-profile.php page
Warning: mysqli::query(): (42000/1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id = j.id' at line 1 in /home/sites/broadwaymediadesigns.co.uk/public_html/sites/security-site/employer-profile.php on line 60 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.id = j.id' at line 1
Thank you in advance
Ian