在SQL中标记调用(Hive)

时间:2015-10-18 14:59:57

标签: sql hive flags

我有一个数据集,我需要标记这些调用,如字段Call_CA中所示,在SQL(Hive)中具有此条件。

在同一电话号码中,对于在呼叫CA之前拨打到其他LOB的呼叫,请将这些呼叫标记为BEFORE。对于在调用CA后拨打到其他LOB的呼叫,将这些呼叫标记为AFTER。

请您告诉我怎么做?

感谢大家的帮助。

gen_source_address  Called_Time LOB Call_CA
2012123923  3/20/2015 18:10:00  ca  
2012123923  3/20/2015 18:15:00  cl  After
2012123923  4/20/2015 11:30:00  ca  
2012123923  4/20/2015 11:31:00  ca  
2012123923  4/20/2015 11:39:00  cl  After
2012123923  4/20/2015 15:36:00  cl  After
2012123923  4/27/2015 12:40:00  cl  After
2012123923  4/28/2015 10:07:00  cl  After
2012123923  4/28/2015 11:58:00  cl  After
2012136626  1/10/2015 16:02:00  ca  
2012146914  11/23/2014 10:57:00 pl  Before
2012146914  11/23/2014 11:04:00 claim   Before
2012146914  12/1/2014 18:19:00  ca  
2012181514  7/20/2015 16:20:00  ca  
2012181514  7/20/2015 16:24:00  pl  After
2012183018  3/17/2015 11:01:00  pl  Before
2012183018  3/17/2015 11:28:00  pl  Before
2012183018  3/17/2015 11:37:00  pl  Before
2012183018  4/8/2015 16:50:00   ca  
2012183018  4/8/2015 16:52:00   pl  After
2012201789  11/15/2014 1:30:00  claim   Before
2012201789  11/15/2014 1:55:00  ca  
2012201789  11/15/2014 0:30:00  claim   After
2012204480  1/10/2015 16:47:00  ca  
2012204480  1/10/2015 16:48:00  pl  After
2012223263  1/17/2015 10:54:00  ca  
2012223263  1/17/2015 10:58:00  pl  After
2012223263  4/4/2015 11:58:00   pl  After
2012223263  12/21/2014 11:28:00 pl  After

0 个答案:

没有答案