Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    3

    Unanswered: Random sampling from a join

    I have a scenario to retrieve a RANDOM Sampling of only 10% of the rows or max of 5 rows from a 3 table join.
    When RAND() function is used, it gives unpredictable results. For example: for the same query few iterations later it does not give result set. And also the result set is the same always(no change in order). Is there an alternative?

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Random sampling from a join

    You have not mentioned what version of db2 you use ...

    In db2 V8 for luw, you can get a resultset by sampling a portion of the records ...

    RAND() function will be behaving the way you mention ...

    Cheers
    Sathyaram

    Originally posted by Anchala
    I have a scenario to retrieve a RANDOM Sampling of only 10% of the rows or max of 5 rows from a 3 table join.
    When RAND() function is used, it gives unpredictable results. For example: for the same query few iterations later it does not give result set. And also the result set is the same always(no change in order). Is there an alternative?
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Oct 2003
    Posts
    3

    RANDOM SAMPLING - DB2

    DB2 Ver 6.1 is been used. Perhaps thats the reason it was retrieving unpredictable results...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •