2011/02/24

Simple Lesson : Insert Field value from another table Query

We can move a number of field values from one table to another table, but the number columns and their data types must match.

example :

1. We Have one table with some field like this :

Table : employee
Field : name,contract,status

2.We have another table like this :

Table : manager
Field : name, contract.

3. First step we insert value to Employee table

Insert employee (name,contract,status)
values ('Billy','10 Years','Senior')

4. Second step we insert value from employee table which status Senior

Insert manager (name,contract)
select name,contract from employee
where status = 'Senior'

No comments:

Post a Comment

Your Comment