I have am attempting to randomly sample random entries for a one-week period. In order to ensure that I have a balance of weekday and weekend entries, I have sketched out 2 separate sql statements as follows:
select * FROM admin.acct_activity
where RANDOM() <=1
--weekday
and extract(day from page_hit_ts) Between 6 and 10
limit 500
UNION all
SELECT *
FROM admin.acct_activity
where RANDOM() <=1
--weekend
and extract(day from page_hit_ts) Between 11 and 12
limit 200
/* to-do
1. limit results for each query
2. order query results by date*/
error message is:
"all" (at char 121) expecting a keyword (State:42000, Native Code: 1B)
this is in Netezza SQL (NZSQL)
the limit statement in the first select statement seems to cause the error. Any tips?