Home Forums SQL Server 2008 SQL Server 2008 - General Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed) RE: Puzzle : Generating two unique numbers from an array of numbers (repetation not allowed)

  • Eugene Elutin (9/12/2012)


    You don't really need last join as the last digit of the second number can only be '3'

    Wouldn't that be cheating?

    Because that way I can get the best performance

    SELECT 41286 num1,

    7953 num2

    I had my solution that was very similar to yours (again) but using the different(<>) operators instead of the NOT IN.

    However, a better performance would be using the best datatype for the digits (char) since the beginning avoiding additional conversions.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2