-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Philippe Poelvoorde wrote: | | Insert into comments(list of you fields here ) | select 0,1,null,'testuser','testcomment',max(idx) from comments | where sourceid=1; | | but querying max(idx) is a bad idea. you could get the last inserted id | with the following command : | SELECT last_insert_id() from comments LIMIT 1; | | the last_insert_id is available on a per connection basis. | | but why are you inserting back in comments a field from comments ??? |
~ I looked in the archive for anything about "SQL schema", but there were just two messages, and the original message had no thread with it.
~ I took your suggestion, and tried the following, but got the same error message: INSERT INTO comments (idx,sourceid,created,userid,comment,parentid) VALUES(0,1,NULL,'testuser','this is a test',(SELECT max(idx) FROM comments WHERE sourceid=1))
~ The error is still: You can't specify target table 'comments' for update in FROM clause
- -- "Love is mutual self-giving that ends in self-recovery." Fulton Sheen James Black [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB8AopikQgpVn8xrARAjI2AJ4se/25M8AcUvtO9Q8GAFe62/aIUQCgjVOJ CPYRiuFlXtm+MXhytxo5YKc= =mWUq -----END PGP SIGNATURE-----
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]