Hi!,
INSERT INTO ... SELECT  statement works in MySQL. The web site is :
http://www.mysql.com/doc/I/N/INSERT_SELECT.html

I have no idea what you meant by "it doesn't work for the same tables"..
But as the answer to your question, you could do something like:

SELECT @a:=MAX(fieldname) FROM TABLE;
INSERT INTO TABLE VALUES (@a+1);

Hope this helps..
Gurhan


-----Original Message-----
From: Allon Bendavid [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 18, 2002 10:58 PM
To: [EMAIL PROTECTED]
Subject: INSERT ... SELECT not supported?


Hello All-

I just read that an Insert ... Select naming the same table is not supported
in MySQL.

What is the alternative?  What we need to do is simply insert the max of a
column + 1 to create essentially a counter in a situation where an
auto_increment counter would not work.

Anyone?

-Allon


----------------------------------------------------------------------------
Allon Bendavid                                          Imacination Software
[EMAIL PROTECTED]                            http://www.imacination.com/
805-650-8153
----------------------------------------------------------------------------
Visit Imacination and start selling on the Web today with Ch-Ching!
----------------------------------------------------------------------------




---------------------------------------------------------------------
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


---------------------------------------------------------------------
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

Reply via email to