简体   繁体   中英

I can't make a query select into in 2 table

"Make a query that having all orders by employees from employeeUK in the orderUK table"

my table of employeeUK:

select *
into employeeUK
from Employees
where Country = 'UK'

then i want to make the orderUK table but i got confuse because my query always error. How the query should be?

you have to start with the table you going to insert the data into.

into employeeUK
select *
from Employees
where Country = 'UK'

The question is are you creating a Temp Table to a Perm table. Does the Table already exist or not.

If you are creating a temp table use the following

Select * 
Into #employeeUK
From Employees
Where Country = 'UK'

If this is going into a Perm table you can use the same code as long as the table does not already exist.

If the table already exist then use this code.

Insert Into employeeUK
Select * 
From Employees
Where Country = 'UK'

Remember Temp Tables start with a '#' perm tables do not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM