Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql get last row

SELECT fields FROM table ORDER BY id DESC LIMIT 1;
Comment

mysql select last 10 rows

SELECT * FROM tableName ORDER BY col1 DESC LIMIT 10;
Comment

MYSQL select last query

select `COLUMN_NAME_1`, `COLUMN_NAME_2` from `TABLE_NAME` ORDER BY id DESC LIMIT 1;
Comment

select last row mysql

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

select first and last row mysql

(select *from DemoTable694 order by EmployeeId ASC LIMIT 1)
UNION
(select *from DemoTable694 order by EmployeeId DESC LIMIT 1);
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql query single row 
Sql :: avg mysql 
Sql :: sql count 
Sql :: remove user and their privileges postgres 
Sql :: mysql get last insert id 
Sql :: how to show index type in postgresql 
Sql :: oracle sql pad left zeros 
Sql :: mysql where not equal 
Sql :: mysql ip address data type 
Sql :: sql create view 
Sql :: call function sql oracle 
Sql :: sql concat 
Sql :: postgre describe table 
Sql :: how to generate a unique random number in mysql 
Sql :: function in plsql 
Sql :: sql server alter table add column tinyint 
Sql :: check if value is equal to something sql 
Sql :: sql server convert date to weekday 
Sql :: python sqlite data delete 
Sql :: rename table name 
Sql :: output table plsql 
Sql :: download sql server 2016 
Sql :: alter table add column in sql server 
Sql :: mysql stored procedure vs function 
Sql :: flask sqlalchemy update row 
Sql :: remove auto increment mysql 
Sql :: com.mysql.cj.exceptions.InvalidConnectionAttributeException more than one time zone. You must configure either the server or JD value if you want to utilize time zone support. 
Sql :: mysql order by 
Sql :: how to remove unique key in mysql 
Sql :: dba_dependencies 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =