Hive 多个子查询错误。请告诉我如何解决此问题

Hive 多个子查询错误。请告诉我如何解决此问题,hive,Hive,试图在色调编辑器中运行以下代码,但多个子查询失败。请告诉我如何解决此问题 SELECT a.app,a.app_content,a.app_provider,b.app,b.date_hr,b.transdate from (SELECT * FROM table1)a left join (select * from table2 WHERE date_hr=(select max(date_hr )from table2 and transdate=(se

试图在色调编辑器中运行以下代码,但多个子查询失败。请告诉我如何解决此问题

SELECT a.app,a.app_content,a.app_provider,b.app,b.date_hr,b.transdate from
(SELECT * FROM table1)a
left join
(select * from table2
        WHERE date_hr=(select max(date_hr )from table2

         and transdate=(select max(transdate) from table2)b
on a.app=b.app;
这应该行得通

SELECT a.app,a.app_content,a.app_provider,b.app,b.date_hr,b.transdate
from table1 a
left join (select app,max(date_hr) date_hr,max(transdate) transdate from table2 group by app) b
    on a.app=b.app;

感谢您的回复。表2中没有max(date_hr)列,我必须根据max(date_hr)和max(transdate)筛选表2中的数据。我可以使用hive变量分配max值并在脚本中使用它们吗?请帮助我尝试执行上述语句,看看它是否给出了预期的结果。