Select random from SQL table which evenly distributes across a column's different values
|Added at||2016-12-29 05:12|
I have a table USERS which holds demographic information. For brevity, lets say one of the columns AGE can have one of five values (16, 17, 18, 19, 20).
I would like an SQL query which gives me say, 100 random selections from USERS which are evenly distributed across the different ages, so I'd get approximately (or exactly) 20 entries where AGE=16, 20 entries where AGE=17, and so on.
I will at some point need to distribute across multiple columns (eg. results with even distribution across AGE and RACE and INCOME) but need to at least start by knowing how to evenly distribute across one column.