Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Getting a dynamic Sample - response (5) by dnoeth

$
0
0

This should be exactly the output you wanted, it's not a true statistically valid sample, but probably close enough.

When you need to get a better sample using RANDOM you must to nest it in a Derived Table:
SELECT * FROM
(SELECT t.*, RANDOM(1,1000000000) as xxx FROM tab AS t) AS tab
QUALIFY
ROW_NUMBER() OVER (PARTITION BY communication_id ORDER BY xxx) <= 10
...

As your table is small, you can easily do it.

Dieter


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>