Presto SQL/Hive子查询还是加入?
我正在研究一个需要使用另一个Hive表的查询,以使用用户ID号来绘制用户名。仅仅是为了该用户名的结果,还是可以写一个子查询,还是我应该加入?
表1:分配的_tasks具有用于task_number,所有者,标题,描述,进度,ds
表2的列:员工_INFO具有formemeree_id,雇用employee_name,lighteree_team的列
SELECT task_numb,
owner_id,
title,
description,
progress
WHERE ds = 'DATEID'
AND progress != 'FINISHED'
,我需要使用aslore_id(int)从另一个Hive表中获取lighteee_name(string)。加入另一个表或使用子查询并在所有者_ID列中显示结果是有意义的吗?这将如何结构?
例子:
SELECT
task_numb,
(SELECT employee_name
FROM employee_info
WHERE employee_id = owner_id) as Owner
title,
description,
progress
WHERE ds = '<today>'
AND progress != 'FINISHED'
I am working on a query that requires I join with another hive table to pull a username using a user ID number. Is it possible to write a sub-query just for the result of that user name or should I do a Join?
Table 1: Assigned_Tasks has columns for task_number, owner_id, title, description, progress, ds
Table 2: Employee_info has columns for employee_id, employee_name, employee_team
SELECT task_numb,
owner_id,
title,
description,
progress
WHERE ds = 'DATEID'
AND progress != 'FINISHED'
I need to use the owner_id(int) to get employee_name(string) from another hive table. Does it make sense to join with the other table or use a subquery and display the result in the owner_id column? How would that be structured?
Example:
SELECT
task_numb,
(SELECT employee_name
FROM employee_info
WHERE employee_id = owner_id) as Owner
title,
description,
progress
WHERE ds = '<today>'
AND progress != 'FINISHED'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不使用EMP tbale的简单加入?
如果EMP ID在Employee_Info表中是唯一的,则不应该有任何问题。
why not use simple join with emp tbale ?
if emp id is unique in employee_info table, there shouldnt be any issue.