Select Random records

  • Is there an easy way to select a random 15,000 from a 100,000 records.

    the only fields I want is last, first, email

     

    SELECT FIRST, LAST, upper(EMAIL) FROM ACCOUNT

    INNER JOIN MEMBERNAME ON ACCOUNT.ACCOUNTNUMBER = MEMBERNAME.ACCOUNTNUMBER

    WHERE MEMBERNAME.TYPE=0

    AND EMAIL IS NOT NULL

    AND ACCOUNT.CLOSEDATE IS  NULL

    AND ACCOUNT.ACCOUNTNUMBER IN (SELECT ACCOUNTNUMBER FROM ACCOUNTWARNCODE

          WHERE WARNCODE <> 98)

    AND DBO.FNGETAGE(BIRTHDATE, GETDATE()) >=18

     

    Thanks Peter

  • SELECT TOP 15000 .....

    ORDER BY NEWID()

  • Thanks, work great

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply