RE: mySQL query help please
[snip] So if the end result is to have the records selected appended to the Customer_Equipment table, I have to make a temporary table based on the characteristics of the Customer_Equipment table... then insert from that temporary table. Correct? [/snip] BINGO! Goofy rules can be frustrating :) Jay sql, mysql, query (goofy spam rule) - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: mySQL query help please
Greetings Jay: RE: mySQL query help please I love rules that don't make sense ;-) So if the end result is to have the records selected appended to the Customer_Equipment table, I have to make a temporary table based on the characteristics of the Customer_Equipment table... then insert from that temporary table. Correct? Thank you. At 12:29 PM 6/24/2002 -0500, you wrote: >[snip] >INSERT INTO Customer_Equipment SELECT Customer.ID, Server_ID, >Configuration, Equipment_Type, Group_ID, Location, Rack_Location, >Network_Status_Name, Creator_ID, Primary_IP_Address FROM >Customer_Equipment, Customer WHERE SUBSTRING(Server_ID, 5,4) = >Customer.User_ID; > >The select statement works perfectly, but when I try to combine the select >statement with an INSERT INTO statement (I've done this in the past), I get >the error message: > > ERROR 1066: Not unique table/alias: 'Customer_Equipment' >[/snip] > >You cannot INSERT into a table that you have SELECT 'ed from; > >INSERT INTO Customer_Equipment SELECT ... >FROM Customer_Equipment, Customer Peter M. Perchansky, President/CEO Dynamic Net, Inc. Helping companies do business on the Net 420 Park Road; Suite 201 Wyomissing PA 19610 Non-Toll Free: 1-610-736-3795 Personal Email: [EMAIL PROTECTED] Company Email: [EMAIL PROTECTED] Web:http://www.dynamicnet.net/ http://www.manageddedicatedservers.com/ http://www.wemanageservers.com/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: mySQL query help please
[snip] INSERT INTO Customer_Equipment SELECT Customer.ID, Server_ID, Configuration, Equipment_Type, Group_ID, Location, Rack_Location, Network_Status_Name, Creator_ID, Primary_IP_Address FROM Customer_Equipment, Customer WHERE SUBSTRING(Server_ID, 5,4) = Customer.User_ID; The select statement works perfectly, but when I try to combine the select statement with an INSERT INTO statement (I've done this in the past), I get the error message: ERROR 1066: Not unique table/alias: 'Customer_Equipment' [/snip] You cannot INSERT into a table that you have SELECT 'ed from; INSERT INTO Customer_Equipment SELECT ... FROM Customer_Equipment, Customer HTH! Jay sql, mysql, query - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php