All Forums Database
diecast 3 posts Joined 08/15
28 Aug 2015
Random sampling question

I have a issue where I want a random selection of transactions but need them each from a user that handled them. Each user would of touched 50-100 transactions and I need a sample of 3 from each agent. I know how to randomly grab transactions but not how to make sure i'm getting them from each agent not just random as a whole. 

Adeel Chaudhry 773 posts Joined 04/08
30 Aug 2015

When you say you know 'how to randomly grab' what exactly do you mean?
Basically, what you need is RANK function with PARTITION on Agent, and put a QUALIFY on that RANK to filter only 3 rows.

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.