Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to get id of last inserted row in mysql

mysql> select *from LastInsertedRow where Id=(SELECT LAST_INSERT_ID());
Comment

mysql get last insert id

SELECT MAX(id) AS last_id FROM users
-- last_id --
-- 33 --
Comment

mysql set last_insert_id

SET @last_id = LAST_INSERT_ID();
Comment

mysql get last inserted id

-- To get the last inserted auto-increment row ID: --
SELECT LAST_INSERT_ID( optional_expression )

-- If you have just inserted it using a command in C# use: --
int lastId = (Int32)yourCommand.LastInsertedId;
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle select first result 
Sql :: join in update query in mysql 
Sql :: how to get the date from datetime in mysql 
Sql :: pl/sql procedure example 
Sql :: sql pagination offset 
Sql :: sql percentage with % rounded down 
Sql :: mysql ip address data type 
Sql :: mysql compare datetime to another datetime 
Sql :: SELECT exists sql 
Sql :: sql date format 
Sql :: mysql select into new table 
Sql :: sql count number of rows after group by 
Sql :: drop primary key oracle 
Sql :: RowDataPacket 
Sql :: restroe pg_dump example 
Sql :: duplicate entry 
Sql :: mysql shell clear screen 
Sql :: how to enable extension in postgreSQL 
Sql :: postgresql get date now 
Sql :: mysql update column to be nullable 
Sql :: oracle drop sequence 
Sql :: sqlalchemy postgres timestamp with timezone 
Sql :: xampp mysql version 
Sql :: show query code after create table in sql 
Sql :: sql server previous month 
Sql :: sort by mysql 
Sql :: default number in sql 
Sql :: postgres update single column 
Sql :: create temporary table sql 
Sql :: sql download for windows 10 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =