Hi everyone, I need to display only the first 3 rows from a table. AT present I'm selecting all rows then t'm displaying the 1st 3 rows using a loop. Is there a direct way or a more efficient way to select only the 1st 3 rows from the table?
select col1, col2, col3 from table limit 3;
http://www.mysql.com/doc/S/E/SELECT.html
u can do the query as follows: to choose the last 3 rows(latest one): SELECT * FROM database ORDER BY Sno DESC LIMIT 3