Skip to content

Commit bb27ad1

Browse files
committed
Create select_top_n.sql
1 parent 0896d30 commit bb27ad1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hive-workflow/select_top_n.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE TABLE top_cool AS
2+
SELECT r.business_id, name, SUM(cool) AS coolness, '${date}' as `date`
3+
FROM review r JOIN business b
4+
ON (r.business_id = b.business_id)
5+
WHERE categories LIKE '%Restaurants%'
6+
AND `date` = '${date}'
7+
GROUP BY r.business_id, name
8+
ORDER BY coolness DESC
9+
LIMIT ${n}

0 commit comments

Comments
 (0)