MySQL distinct random selection

Discussion in 'MySQL' started by manaila, Feb 4, 2013.

  1. manaila

    manaila New Member

    Joined:
    Jul 6, 2010
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    On Earth
    I have two tables tbl1 and tbl2.
    I want to randomly select 10 rows from tbl1 which do not appear in tbl2.

    NB:
    I can do random selection from one table using:
    Code:
    SELECT * FROM tbl1
    ORDER BY rand()
    LIMIT 10;
    
    Please assist on this.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice