I have these tables:
jobs:
jobid int auto-increment
position varchar(20)
dept int
description text
dept:
deptid int auto-increment
dept varchar(10)
Consider this mysql select statement:
SELECT * FROM jobs,dept WHERE (jobs.dept=dept.deptid)
The jobs table contains the dept id number and the dept table contains the dept id number and the dept name (e.g. Engineering). Using this statment, I can list the full dept name from the dept table while listing the info in the jobs table.
Question: how would I use this syntax for an insert statement. I have the full dept name, but I'd like to insert the dept id number into jobs. I tried this but was not successful:
INSERT INTO jobs,dept ('position','dept','description) WHERE jobs.dept=dept.deptid values ('$position','$dept','$desc')
Suggestions?