MySQL Forums
Forum List  »  MySQL Network and You

Insert with sub-routine select fails (v3.23.58)
Posted by: Paul Thompson
Date: December 17, 2005 08:37AM

Help needed please!

I cannot get a insert with a inbuild select routine to work, yet I read it should work.

- Mysql Version
[root@f1 source]# mysql -V
mysql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)

- Select syntax and output
mysql> SELECT ID FROM Equipment o, Customer c WHERE c.UserID = "paul.thompson" AND c.CustomerID = o.OwnerID;
+----+
| ID |
+----+
| 1 |
+----+
1 row in set (0.08 sec)

- Insert that fails!!!
mysql> INSERT INTO BandwidthHistory
-> ( EquipmentID , BandwidthUp , LastUp , BandwidthDown , LastDown , Date )
-> VALUES (
-> (SELECT ID FROM Equipment o, Customer c WHERE c.UserID = "paul.thompson" AND c.CustomerID = o.OwnerID),
-> "0",
-> "225688",
-> "0",
-> "1025389",
-> "2005-11-30" )
-> ;
ERROR 1064: You have an error in your SQL syntax near 'SELECT ID FROM Equipment o, Customer c WHERE c.UserID = "paul.thompson" AND c.C' at line 4
mysql>

If the above is not supported, then is there another SQL method that can be implemented?

Options: ReplyQuote


Subject
Written By
Posted
Insert with sub-routine select fails (v3.23.58)
December 17, 2005 08:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.