How to use limit and order by clause in same sql query?

 


Limit clause is use to limit the number of records that we get in the select query whereas order by is use to get the records in some specific order either ascending or descending order depending on the requirements of the dataset. Below is the code snippet to show how both can be used together:

Select * FROM table where val <> '' and FIND_IN_SET('1',val) > 0 order by creation_date desc limit 0,30

 


Related #tags:     #mysql     #sql    

Related questions




Looking for change? Click below to prepare for technical interview.


Technical Interview Questions