Search
 
SCRIPT & CODE EXAMPLE
 

SQL

how to get last row of table in sql

mysql> select *from getLastRecord ORDER BY id DESC LIMIT 1;
Comment

select last row in sql

SELECT TOP 1 * FROM Table ORDER BY ID DESC
Comment

Select last row from SQL Table

SELECT * FROM TableName WHERE id=(SELECT max(id) FROM TableName);
Comment

select last row in sql

SELECT
  (SELECT * FROM tableName ORDER BY col1 LIMIT 1)        AS first,
  (SELECT * FROM tableName ORDER BY col1 DESC LIMIT 1)   AS last
;
Comment

PREVIOUS NEXT
Code Example
Sql :: alter foreign key 
Sql :: how to duplicate table in mysql 
Sql :: oracle find text in functions 
Sql :: wordpress change url in database 
Sql :: psql filed name alter 
Sql :: mysql version check cmd 
Sql :: created at and updated at in mysql 
Sql :: delete first row in sql 
Sql :: mysql allow remote connections 
Sql :: oracle service name view 
Sql :: create table if not exist in sqlite 
Sql :: mariadb alter user host 
Sql :: oracle sql first day of month 
Sql :: postgresql reset auto increment 
Sql :: how to add a index to live table mysql 
Sql :: select dba users oracle 
Sql :: import database through command line 
Sql :: stop psql server windows 
Sql :: mysql set field unique 
Sql :: postgres delete last row 
Sql :: how to check database username and password in postgresql 
Sql :: restart identity cascade 
Sql :: tsql find foreign key references 
Sql :: query any digits record 
Sql :: mysql reset auto increment 
Sql :: how to check nls timestamp format in oracle 
Sql :: how to connect mysql with specify port thorugh cmd 
Sql :: mssql get running queries 
Sql :: how to get the ddl for datafile in oracle tablespace 
Sql :: postgresql if null then 0 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =