Questions tagged [last-insert-id]

LAST_INSERT_ID is MySQL specific functionality to get the value of the AUTO_INCREMENT column most recently inserted into. It is the recommended means of getting the value in MySQL, because SELECT MAX(auto_increment) ... is not reliable, as concurrency problems can occur.

LAST_INSERT_ID is MySQL specific functionality to get the value of the AUTO_INCREMENT column most recently inserted into. It is the recommended means of getting the value in MySQL, because SELECT MAX(auto_increment) ... is not reliable, as concurrency problems can occur.

That said, this functionality is not ANSI. Sequences are now ANSI, supported by DB2, Oracle, PostgreSQL, and SQL Server "Denali"). The ANSI equivalent to LAST_INSERT_ID would be: CURRVAL ( NEXTVAL is used to get the next value).

Documentation:

215 questions
-1
votes
1 answer

How to delete data based on rowid

Using python, how do i get to delete data based on lastrowid. The code i have deletes all the rows CODE: import re import sys import difflib import sqlite3 def main(): while True: name = input ('Please Type your Question: …
lobjc
  • 2,751
  • 5
  • 24
  • 30
-1
votes
1 answer

PDO last insert id return 0

Am facing in problem with last insert id, this is my table structure CREATE TABLE `user` ( `id` int(30) NOT NULL AUTO_INCREMENT, `fbtoken_id` varchar(255) DEFAULT NULL, …
Dibish
  • 9,133
  • 22
  • 64
  • 106
-2
votes
1 answer

Java Last Insert ID is not working

Possible Duplicate: How to get the insert ID in JDBC? I was trying to get the last insert ID, but apparently it's not working, it keeps on giving me a bunch of errors one of them is this java.sql.SQLException: Can not issue SELECT via…
user962206
  • 15,637
  • 61
  • 177
  • 270
-3
votes
1 answer

Using last inserted id in mysql multi query

I am trying to use last inserted id in MySQL muli_query but I don't know what I missed this is my code : $query = "INSERT INTO posts (nparc,id_chauffeur,id_camion, lot_de_bord,triangle,pelle,balai,date) …
-3
votes
2 answers

getting value from 'last_insert_id()', the php function

I have a problem with getting a value from 'last_insert_id()'.. I want to insert a same id number to id of table 'memo'. However, the problem is after foreach, last_insert_id() gets a new value, so, I tried to make a variable and get a value from…
1 2 3
14
15