hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohit Anchlia <mohitanch...@gmail.com>
Subject Re: HIVE NOT EXISTS
Date Mon, 01 Oct 2012 22:59:20 GMT
thanks! that works

On Mon, Oct 1, 2012 at 3:43 PM, Matt Tucker <matthewtckr@gmail.com> wrote:

> Hi Mohit,
>
>
>
> Hive doesn’t support correlated subqueries.  In this instance, you can do
> a left outer join to find values that are not in a table.
>
>
>
>  SELECT
>
>      “”,
>
>      a.pagename,
>
>      a.pagedetail,
>
>      “”,
>
>      a.pagetitle,
>
>      a.page_id,
>
>      a.pagetype
>
>  FROM page_temp_ext a
>
>      LEFT OUTER JOIN page_temp b ON
>
>          a.pagename = b.pagename AND
>
>          a.pagetitle = b.pagetitle AND
>
>          a.page_id = b.pageid AND
>
>          a.pagetype = b.pagetype
>
>  WHERE
>
>      b.pagename IS NULL
>
>
> Hope that helps,
>
> Matt
>
>
>                      On Mon, Oct 1, 2012 at 4:42 PM, Mohit Anchlia <
> mohitanchlia@gmail.com> wrote:
>
>> Could someone help me understand what alternative do I have for this
>> query? I am trying to check if a given row exists in the table.
>>
>> select "",a.pagename,a.pagedetail,"",a.pagetitle,a.page_id,a.pagetype
>>   from page_temp_ext a
>> where 0 = (select count(*) from page_temp b where a.pagename = b.pagename
>> and a.pagetitle = b.pagetitle and a.page_id = b.pageid and a.pagetype =
>> b.pagetype);
>>
>
>

Mime
View raw message