When I try to execute following query:
SELECT id_subscriber
INTO newsletter_to_send
FROM subscribers
I get an error:
#1327 - Undeclared variable: newsletter_to_send
What is wrong with that query ?
When I try to execute following query:
SELECT id_subscriber
INTO newsletter_to_send
FROM subscribers
I get an error:
#1327 - Undeclared variable: newsletter_to_send
What is wrong with that query ?
I think you can follow my given way and hopefully you will be able to fix your problem.
At first use this sql command to create a new table where you want to take backup
After then you can use this command to copy those data
If you already have previous data in your Destination table , Firstly you can use this command
Thanks By Md. Maruf Hossain
MySQL Server doesn't support the SELECT ... INTO TABLE Sybase SQL extension. Instead, MySQL Server supports the INSERT INTO ... SELECT standard SQL syntax, which is basically the same thing. See Section 12.2.5.1, “INSERT ... SELECT Syntax”.
Ref:- this
http://dev.mysql.com/doc/refman/5.1/en/insert-select.html
PS: are you sure you don't need in
WHERE
clause?MySQL does not support
SELECT INTO [table]
. It only supportsSELECT INTO [variable]
and can only do this one variable at a time.What you can do, however is use the
CREATE TABLE
syntax with aSELECT
like so:mysql don't support SELECT ... INTO ... syntax,
if it's a new table, use CREATE TABLE ... SELECT ... syntax.
example:
read more here create-table-select