Randon Results Required from MYSQL

Discussion in 'Programming' started by jvmills, Jan 3, 2007.

  1. #1
    Hi, I often use SQL Server's ORDER BY NEWID() clause in conjunction with a SELECT TOP n to produce a specified number of random results from a table or view.

    can anyone tell me if there is an equivalent function in MYSQL ? I am familiar with the LIMIT clause, but cannot find anything that will produce n random records.

    Thanks
     
    jvmills, Jan 3, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    ORDER BY RAND()
    
    Code (sql):
     
    nico_swd, Jan 3, 2007 IP