Impala SQL left join on t1 vs t2
Impala SQL left join on t1 vs t2
我在此处连接时遇到问题,特别是在 x=y 上
在 SQL Impala 中,有人可以帮助我了解它是如何工作的。 SUBSTR(cast(t1.employee_number as string), 3,10) as short_employee_number
工作正常,我测试过,但是当我构建这个左连接时,我不明白 x=y 上最终应该是什么
我试过了
SUBSTR(cast(t1.employee_number as string), 3,10) = t2.short_staff_number
t1.short_employee_number = t2.short_staff_number
short_employee_number= t2.short_staff_number
none 其中有效。
问题是什么?
SELECT DISTINCT
SUBSTR(cast(t1.employee_number as string), 3,10) as short_employee_number,
t1.begin_date_it0001,
t1.end_date_it0001,
t1.cost_center
t1.position,
t2.local_time_createddate,
t2.area,
t2. unit,
t2.short_staff_number,
t2.alias,
t2.email
FROM dataone as t1
LEFT JOIN datatwo as t2
ON
short_employee_number = t2.short_staff_number ;
试试这个
您不能在 FROM
处使用 SELECT FIELDS
,只能在 ORDER BY
处使用
SELECT DISTINCT
SUBSTR(cast(t1.employee_number as string), 3,10) as short_employee_number,
t1.begin_date_it0001,
t1.end_date_it0001,
t1.cost_center
t1.position,
t2.local_time_createddate,
t2.area,
t2. unit,
t2.short_staff_number,
t2.alias,
t2.email
FROM dataone as t1
LEFT JOIN datatwo as t2
ON
SUBSTR(cast(t1.employee_number as string), 3,10) = t2.short_staff_number ;
我在此处连接时遇到问题,特别是在 x=y 上
在 SQL Impala 中,有人可以帮助我了解它是如何工作的。 SUBSTR(cast(t1.employee_number as string), 3,10) as short_employee_number
工作正常,我测试过,但是当我构建这个左连接时,我不明白 x=y 上最终应该是什么
我试过了
SUBSTR(cast(t1.employee_number as string), 3,10) = t2.short_staff_number
t1.short_employee_number = t2.short_staff_number
short_employee_number= t2.short_staff_number
none 其中有效。
问题是什么?
SELECT DISTINCT
SUBSTR(cast(t1.employee_number as string), 3,10) as short_employee_number,
t1.begin_date_it0001,
t1.end_date_it0001,
t1.cost_center
t1.position,
t2.local_time_createddate,
t2.area,
t2. unit,
t2.short_staff_number,
t2.alias,
t2.email
FROM dataone as t1
LEFT JOIN datatwo as t2
ON
short_employee_number = t2.short_staff_number ;
试试这个
您不能在 FROM
处使用 SELECT FIELDS
,只能在 ORDER BY
SELECT DISTINCT
SUBSTR(cast(t1.employee_number as string), 3,10) as short_employee_number,
t1.begin_date_it0001,
t1.end_date_it0001,
t1.cost_center
t1.position,
t2.local_time_createddate,
t2.area,
t2. unit,
t2.short_staff_number,
t2.alias,
t2.email
FROM dataone as t1
LEFT JOIN datatwo as t2
ON
SUBSTR(cast(t1.employee_number as string), 3,10) = t2.short_staff_number ;