ok, something like this ought to work:
insert into job (id, empid, firstname, lastname, state, zip) select id, empid, firstname, lastname, state, zip from consu, emp where empid = SOMEVALUE and id = SOMEOTHERVALUE;
Ideally, you would probably want a relationship (foreign key) between the emp table and the consu table. Since you already have a primary key in both tables, I would just have emp.empid = consu.id, then the sql would look like this:
insert into job (id, empid, firstname, lastname, state, zip) select id, empid, firstname, lastname, state, zip from consu, emp where empid = id and id = SOMEVALUE;
if they are different, then just stick with the first SQL.
D
nsj wrote:
david,
once again thanks. check this.
1. the empid from the emp table based on autono
2. the id,firstname,lastname,state,zip.... from the consu based on id
3. insert id,empid,firstname,lastname,state,zip with above values in the job table.
i want insert these datas with one sqlquery with out using the temporary variable.
and i am using mysql database also.