create procedure spjoin3tables begin select tbl_jobs.jobtitle, tbl_company.compname tbl_jobs inner join tbl_company on tbl_jobs.compid = tbl_company.id select tbl_cities.cityname tbl_cities inner join tbl_jobcities on tbl_cities.id = tbl_jobcities.cityid inner join tbl_jobs on tbl_jobcities.jobid = tbl_jobs.id end
the result 2 tables. want 3 columns in 1 table - query?
you need add company table , columns first query second query , make sure join on company id.
select tbl_cities.cityname, tbl_jobs.jobtitle, tbl_company.compname tbl_cities inner join tbl_jobcities on tbl_cities.id = tbl_jobcities.cityid inner join tbl_jobs on tbl_jobcities.jobid = tbl_jobs.id inner join tbl_company on tbl_jobs.compid = tbl_company.id
Comments
Post a Comment