sql—如何在选择其他列时清楚地选择列

tquggr8v  于 2021-06-24  发布在  Hive
关注(0)|答案(0)|浏览(185)

我在 hive 里有一张这样的table。我想做的是运行一个查询,这样每3个小时,我就会查看惟一的workerUID并对它们进行一些操作。所以我要做的是从现在到3小时前
捕获所有独特的WorkerUID Select * from these workerUUIDs 我正在使用配置单元来运行这个查询,表每三到六个小时就有几百万个条目。编写此查询的最佳方法是什么?

--------------------------------------------
| workerUUID | City |  Debt  | TestN| LName| 
|------------------------------------------|
| 1234       |  SF  |  100k  | 23   |  Nil |
|-------------------------------------------
| 6789       |  NY  |  150k  | 34   |  Fa  |
|------------------------------------------|
| 1234       |  SF  |  10k   | 45   |  Na  |
--------------------------------------------
| 6789       |  NY  |  1k    | 13   |  Nil |
|-------------------------------------------
| 6789       |  SF  |  150k  | 34   |  Nil |
|------------------------------------------|
| 8999       |  IN  |  10k   | 45   |  Na  |
--------------------------------------------

基本上我想做一些

select City, Debt, TestN where workerUUID = '1234'
 select City, Debt, TestN where workerUUID = '6789'
 select City, Debt, TestN where workerUUID = '8999'

为了进一步澄清,我想生成临时表,如

| workerUUID | City |  Debt  | TestN| 
|------------------------------------
| 1234       |  SF  |  100k  | 23   |
|------------------------------------
| 1234       |  SF  |  10k   | 45   |
|-----------------------------------|

| workerUUID | City |  Debt  | TestN| 
|------------------------------------
| 6789       |  NY  |  150k  | 23   |
|------------------------------------
| 6789       |  NY  |  1k    | 13   |
|------------------------------------
| 6789       |  NY  |  150k  | 34   |
|-----------------------------------

| workerUUID | City |  Debt  | TestN| 
|------------------------------------
| 8999       |  IN  |  10k   | 45   |


对于3小时间隔内生成的WorkerUID的所有唯一值

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题