Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 30 Jan 2002 @ 09:34:29 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: SAMPLE statement for multiple groups
 
From:   Dieter Nöth

If you're running R4 you could use the RANDOM function:

select ...
where
  (group_id = 1 and random(1,100) <= 5)  --5%
or
  (group_id = 2 and random(1,100) <= 20)  --20%
or
  (group_id = 3 and random(1,100) <= 10)  --10%

Sample uses the random function, but there's a difference: a sample 0.1 from 100 records is always 10 records a random(1,100) <= 10 is about 10 records, sometimes less sometimes more

Dieter



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016