Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how to write a correlated subquery in hive

how to write a correlated subquery in hive

Expert Contributor

How to use data from outer query in the inner query or subquery in hive?I am trying to use ndo.FromDate and ndo.ToDate in the second JOIN but that would not work

    LEFT JOIN 
    Temp.NumberOfDaysOnline ndo
    ON
    ndo.sku = nr.sku
    JOIN
    gadb.gasessiondata gasessiondata
    ON 
    1=1
    LEFT JOIN 
    (
     SELECT SUM(gasessiondata.sessions) As visitsOnDaysSKUWasLive
     FROM 
     gadb.gasessiondata gasessiondata
     WHERE 
     gasessiondata.date >= ndo.FromDate
     AND 
     gasessiondata.date < ndo.ToDate
     ) AS visits