‘workersassigned’ had 3 columns id, worker, job
1 , 23, 44
2, 23, 45
3, 23, 67
Gets data from the worker 44 like name, and gets data of the job 23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
SELECT workers.fname AS fname, workers.sname AS sname, workers.rep AS rep, jobs.id AS jobid, workers.id AS workerid, workers.mobile AS workermobile, jobs.jobtitle AS jobtitle, jobs.refnumber AS jobref FROM workersassigned INNER JOIN workers ON workers.id = workersassigned.workerid INNER JOIN jobs ON jobs.id = workersassigned.jobid |