خرید بک لینک

Vote count: 0

I'm trying to produce a fully refreshed set of numbers each week, pulling from a table in hive. Right now I using this method:

SELECT
COUNT(DISTINCT case when timestamp between TO_DATE("2016-01-28") and TO_DATE("2016-01-30") then userid end) as week_1,
COUNT(DISTINCT case when timestamp between TO_DATE("2016-01-28") and TO_DATE("2016-02-06") then userid end) as week_2
FROM Data;

I'm trying to get something more along the lines of:

SELECT Month(timestamp), Week(timestamp), COUNT (DISTINCT userid) FROM Data Group By Month, Week

But my week runs Sunday to Saturday. Is there a smarter way to be doing this that works in HIVE?

asked 48 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 8 تير 1395 ساعت: 2:05

صفحه بندی