+ 1

How to get first and last record from a table?

1st Sep 2016, 4:39 AM
Kirtiranjan Sahoo
Kirtiranjan Sahoo - avatar
3 Réponses
+ 2
you can to try this: SELECT columns FROM table ORDER BY id DESC LIMIT 1 UNION ALL SELECT columns FROM table ORDER BY id ASC LIMIT 1
1st Sep 2016, 12:41 PM
Andrei Berval
Andrei Berval - avatar
+ 1
Select * from (select * from table_name order by rownum desc) where rownum=1 Union Select * from(select * from table_name order by rownum) where rownum =1; I found this solution
2nd Sep 2016, 3:31 AM
Kirtiranjan Sahoo
Kirtiranjan Sahoo - avatar
- 1
select columnname from tablename where firstname ='' and lastname ='';
1st Sep 2016, 6:09 AM
jambulingam R