Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Counter In SQL

  • 01-11-2006 2:45pm
    #1
    Closed Accounts Posts: 73 ✭✭


    Can some one please tell me how to display a random number of records from a database using SQL.


Comments

  • Registered Users, Registered Users 2 Posts: 379 ✭✭TheWaterboy


    do u mean something like this:

    SELECT * FROM tbl_name ORDER BY RAND() LIMIT 15


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Very much depends on which system you're using, but fundamentally you're gonna use a TOP, LIMIT, ROWNUM or whatever your DB offers against a RAND function of some description as just described.

    Seems like an odd thing to want to do though.

    jc


  • Closed Accounts Posts: 73 ✭✭gerryjuice


    Just need to get a representation of the data within a table, so needed to get a random selection.
    Thanks for the help.


Advertisement