-1

Please tell me that why am i getting error and what should i do to get result.

Tables in my database

+--------------------+
| Tables_in_practice |
+--------------------+
| employee           |
| employee_duplicate |
| employee_record    |
+--------------------+

3 rows in set (0.00 sec)

QUERY

select *
into employee_duplicate
from employee;

ERROR 1327 (42000): Undeclared variable: employee_duplicate

3

1 Answer 1

0

In MySQL, you cannot set the entire row to a variable. Perhaps you just want to return the column:

select employee_duplicate
from employee;

If you want to set a variable, you can do:

select @employee_duplicate := employee_duplicate
from employee;

Although you can use into, most people find the := syntax simpler to follow and to write.

Sign up to request clarification or add additional context in comments.

1 Comment

I do not want to set a variable .I wanna transfer data from one table to another table by using select......into statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.