Results 1 to 4 of 4
y helo thar
I'm having problems creating a new table using SELECT INTO. I was trying it with a PHP script, but on a MySQL prompt it has the same ...
- 03-28-2008 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 26
SQL: Can't create new table with SELECT INTO
y helo thar
I'm having problems creating a new table using SELECT INTO. I was trying it with a PHP script, but on a MySQL prompt it has the same effect - it looks for the table and doesn't find it (see below).
mysql> SELECT * INTO WAN_Gateway_4
-> FROM `WG4_GigabitEthernet` , WG4_Serial, CPE, WG4_Vrfs
-> WHERE WG4_GigabitEthernet.VRF = WG4_Vrfs.VRF
-> AND WG4_Serial.VRF = WG4_Vrfs.VRF
-> AND CPE.IP_Address = WG4_Vrfs.IP_address
-> ORDER BY WG4_GigabitEthernet.VRF;
ERROR 1327 (42000): Undeclared variable: WAN_Gateway_4
However from reading this usually excellent resource:
SQL SELECT INTO Statement
I get the impression a table can be created simply by invoking the command in the first example.
what am I doing wrong? Is there any way to get around this? I really don't want to have to create the table manually :E
- 03-31-2008 #2
- 03-31-2008 #3Just Joined!
- Join Date
- Mar 2008
- Posts
- 26
Wel, they're not necessary per se, but I've hacked phpmyadmin and I'm uusing it as a web front end - it puts them in automatically sometimes. I've just created this table, and it still comes up with the same error
- 04-01-2008 #4Just Joined!
- Join Date
- Mar 2008
- Posts
- 26
Found out how to do it - apparantly what I wanted to do isn't supported in MySQL. It's:
INSERT INTO [tablename]
SELECT [fields]


Reply With Quote
