So in my insert into .... select, I would just add another Select???? Like
this:

INSERT INTO tablename (field1,field2,field3)
SELECT table2.field1, table2.field2, table2.field3
FROM table2
SELECT LAST_INSERT_ID();


Dave Carter
Chief Web Architect
Accelerated Business Technologies, Inc.
http://www.abti.cc
717.464.2970

Filter Lovin: sql, database, query

-----Original Message-----
From: Billy Passauer [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 25, 2001 10:18 AM
To: Dave Carter
Subject: RE: LAST_INSERT_ID Issues


> -----Original Message-----
> From: Dave Carter [mailto:[EMAIL PROTECTED]]
>
> This does not return any results
>
> SELECT LAST_INSERT_ID() FROM tablename;

What did you do prior to executing the statement?  If you didn't do an
INSERT into a table that has an autoincrement field (while using the
same connection), you won't see any results.  Well, actually I just
tried that and it returned 0 (zero) - is that what you mean when you
say it doesn't return any results?  If I do what you said, I get a
zero returned for each row that is in the table.
BTW, drop the "FROM tablename", the syntax is just: SELECT
LAST_INSERT_ID();

 ... Billy ...



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