MySQL Forums
Forum List  »  Newbie

Re: how to Display half records from table?
Posted by: Peter Brawley
Date: November 09, 2019 10:44AM

Use a Prepared Statement ...

set @sql = concat( "select * from aadhar order by id limit ",
                   (select floor(count(*)/2) from aadhar)
                 );
prepare stmt from @sql;
execute stmt;
drop prepare stmt;

Notice the stmt needs an Order By clause if you want a repeatable result.

Options: ReplyQuote


Subject
Written By
Posted
Re: how to Display half records from table?
November 09, 2019 10:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.