What is wrong with the syntax? its been wrecking my head for ages. Could someone scan their eyes over it please?
SELECT C_Name, C_StreetNumber, C_StreetName, C_Postcode, C_County, C_Tele, C_Website, Contact_Forename, Contact_Surname, Contact_Email, Job_Type, Job_Price
FROM Company, Jobs ON Company.Company_ID = Jobs.Company_ID
WHERE Company.C_County LIKE %belfast% AND Jobs.Job_Type LIKE %virus%
You need to use explicit JOIN
when you use ON
. If not you need to join the two tables in the WHERE
clause.
Also you have to select columns that don't have the same column in both tables otherwise you need to select them as table.column. e.g.
SELECT Company.C_Name, Company.C_StreetNumber, C_StreetName, C_Postcode, C_County, C_Tele, C_Website, Contact_Forename, Contact_Surname, Contact_Email, Job_Type, Job_Price
FROM Company
INNER JOIN Jobs
ON Company.Company_ID = Jobs.Company_ID
WHERE Company.C_County LIKE '%belfast%' AND Jobs.Job_Type LIKE '%virus%'
Have a look here.