Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> HIVE QUERY HELP:: HOW TO IMPLEMENT THIS CASE


Copy link to this message
-
Re: HIVE QUERY HELP:: HOW TO IMPLEMENT THIS CASE
ok. my conscience got the best of me. maybe for worse though. :)

This to me is like giving you a rope and a stool and i don't think it'll
end well.

That said consider something like this:

{code}
select
    a.foo1,
    a.foo2,

    case
    when z.sys_buscd_item_desc1 is null then
       a.sys_buscd_item_desc1

    else
       z.sys_buscd_item_desc1
    end,

    a.fooN_1,
    a.fooN
from

   (
   select
       a.sys_type_cd,  -- join key
       a.age,         -- where clause
       c.sys_buscd_item_desc1
   from
        TABLE1 a
        join  TABLE2 c on isnull(a.age,'00')=c.sys_item
   where
       c.sys_type_cd='AGE'
   ) z

   RIGHT OUTER join TABLE1 a on (z.sys_z.sys_item = coalesece(a.age,'00') )

{code}

i switched your ON clause and WHERE clause so be sure to take that under
consideration. And finally its not tested.

Best of luck.

Cheers,
Stephen
On Tue, Mar 4, 2014 at 7:49 AM, Stephen Sprague <[EMAIL PROTECTED]> wrote: