![]()  |  
 
 
 | 
Archives of the TeradataForumMessage Posted: Mon, 06 Jun 2005 @ 17:31:07 GMT
 
 Hi Gurus, I need to get a sample of x records per rep id. I know how to get a sample from the entire table set, but need to know how to do this for each of a group of ids. 
     ******************************************
     My original query is:
     select    APP_NUM,
                 REP_ID
     FROM TABLE T1
     ******************************************
If I add a sample statement to the bottom I get a sample of x records from the entire table. But I need a sample of x records for each REP_ID. If you have any ideas, please fill me in. Intended result: 
     Rep A Sample Record 1
     Rep A Sample Record 2
     Rep A Sample Record 3
     Rep A Sample Record 4
     Rep A Sample Record 5
     Rep B Sample Record 1
     Rep B Sample Record 2
     Rep B Sample Record 3
     Rep B Sample Record 4
     Rep B Sample Record 5
     . .
Regards Arun K Ballari 
  | ||||||||||||||||||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||||||||||||||||||
 
  | ||||||||||||||||||||||||||||||||||||||||||||||||
|  
 | ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||