RE: getting the next ID
"Bonnett, John" <[email protected]> Fri, 25 May 2007 07:58:38 +0930
| Newsgroups | gmane.comp.db.mysql.windows |
|---|---|
| Message-ID | <[email protected]> |
The sort of query you run to get this is SELECT LAST_INSERT_ID(); John Bonnett -----Original Message----- From: Lawson Cronlund [mailto:[email protected]] Sent: Saturday, 12 May 2007 5:02 AM To: 'Mark Mchugh'; 'mysql list' Subject: RE: getting the next ID Mark, If you look up "getlastID" you'll find that this is a per connection variable which contains the auto-increment value from the last INSERT command. As I understand it, Oracle provides a ROWID variable associated with every row of data in the tables. MySQL opted to make this definable by the designer and provides the information on the value with the getlastID variable. In general it's a good idea to define a primary key bigint with automatic increment in every table for the same reasons that Oracle made it universal. Googling for "MySQL getlastID" will give you a lot of information as will looking it up in the MySQL documentation. Regards, Lawson Cronlund -----Original Message----- From: Mark Mchugh [mailto:[email protected]] Sent: Friday, May 11, 2007 7:54 AM To: mysql list Subject: getting the next ID Hi, In oracle there is a function to get the next ID after the current record, is there such a funtion in mysql? thanks ________________________________________________________________________ ____ ________Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545469 -- MySQL Windows Mailing List For list archives: http://lists.mysql.com/win32 To unsubscribe: http://lists.mysql.com/[email protected] -- MySQL Windows Mailing List For list archives: http://lists.mysql.com/win32 To unsubscribe: http://lists.mysql.com/[email protected]