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

get last record in sql

SELECT * FROM TableName WHERE id=(SELECT max(id) FROM TableName);
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 :: drop multiple columns in sql 
Sql :: check if string contains substring sql 
Sql :: mysql count with if 
Sql :: update query with between in mysql 
Sql :: sql server backup table 
Sql :: how to get the date from datetime in mysql 
Sql :: mysql dump specific tables 
Sql :: sql percentage 
Sql :: vowels in sql 
Sql :: mysql date range 
Sql :: import all databases mysql 
Sql :: sql select most frequent value in column 
Sql :: delete all value query 
Sql :: postgres list users and roles 
Sql :: excel export from sql using python 
Sql :: restroe pg_dump example 
Sql :: how to put value in variable mysql 
Sql :: SQL Error 1040 : Too many connections 
Sql :: difference between primary key and unique key 
Sql :: sql select first and last record of each group 
Sql :: python sqlite3 update 
Sql :: csv into data postgres 
Sql :: mysql grant select update insert delete 
Sql :: count in sql and diff 
Sql :: mysql login to a specific database terminal 
Sql :: how to get the date diff of 2 dates in the same fieldin sql server 
Sql :: get number of columns sql 
Sql :: commit in sql 
Sql :: sql query rename table 
Sql :: mysql select statement after index 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =