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

Counter In SQL

Options
  • 01-11-2006 3: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 Posts: 379 ✭✭TheWaterboy


    do u mean something like this:

    SELECT * FROM tbl_name ORDER BY RAND() LIMIT 15


  • Registered Users 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