mysql - Querying for dates listed in another table -
i want select rows of table between 2 dates (which found in seperate table). details of tables , query can found in previous question here (i interested in how in hive/hiveql). current query stands, runs long time seems hang indefinitely, whereas when hardcode in dates runs completion quickly. tables , query reference:
visit_info, these columns:
pers_key - unique identifyer each person pers_name - name of person visit_date - date @ visited business
valid_dates, these columns:
condition - string start_date - date end_date - date
and query itself:
select pers_key, pers_name visit_info cross join (select start_date, end_date valid_dates condition = 'condition1') b (a.visit_date >= b.start_date , a.visit_date <= b.end_date) group a.pers_key
its worth noting im using hive 0.12, getting rid of join , putting select statement in clause out of question. i'm wondering wrong query, or causing fail. suggestions how improve appreciated.
try:
select pers_key, pers_name visit_info join valid_dates b a.visit_date between b.start_date , b.end_date group pers_key, pers_name;
as of hive 0.13:
select pers_key, pers_name visit_info , valid_dates b a.visit_date between b.start_date , b.end_date group pers_key, pers_name;
Comments
Post a Comment