如何连接 2 个表以接收所需的所有数据
How to join 2 tabels in order to receive all the data needed
我有 2 个问题:
/*+ ETLM
{
depend:{
replace:[
{
name:"table_1"
}
]
}
}
*/
SELECT
case_id,
x,
x,
x,
x,
x
FROM table.1
WHERE resolved_date between TO_DATE ('2020/01/01', 'YYYY/MM/DD') and to_date('2020/12/31','YYYY/MM/DD')
AND ASSIGNED_TO_GROUP IN ('First Group')
和
/*+ ETLM
{
depend:{
replace:[
{
name:"table_2"
}
]
}
}
*/
SELECT
x,
x,
x,
case_id,
x,
x
FROM table_2
WHERE create_date between TO_DATE ('2020/01/01', 'YYYY/MM/DD') and to_date('2020/12/31','YYYY/MM/DD')
所以基本上我需要表中的所有信息,case_id 是 table_1 上的主键。我怎样才能加入他们以接收所有数据并仅使用 table_1?
中的 WHERE's
PS:表格是在 redshift
上启用的频谱
我试过了
Select
x
x
x
FROM table_1
JOIN table_2 ON table_1.case_id = table_2.case_id
Select
x
x
x
FROM table_2
Where table_1.resolved_date between ...
AND table_1.assigned_group...
但是我在第二个 SELECT 语句中似乎出错了
Select
table_1.x,
table_1.x,
table_1.x,
table_2.x,
table_2.x,
table_2.x
FROM table_1
JOIN table_2 ON table_1.case_id = table_2.case_id
Where table_1.resolved_date between ...
AND table_1.assigned_group...
我有 2 个问题:
/*+ ETLM
{
depend:{
replace:[
{
name:"table_1"
}
]
}
}
*/
SELECT
case_id,
x,
x,
x,
x,
x
FROM table.1
WHERE resolved_date between TO_DATE ('2020/01/01', 'YYYY/MM/DD') and to_date('2020/12/31','YYYY/MM/DD')
AND ASSIGNED_TO_GROUP IN ('First Group')
和
/*+ ETLM
{
depend:{
replace:[
{
name:"table_2"
}
]
}
}
*/
SELECT
x,
x,
x,
case_id,
x,
x
FROM table_2
WHERE create_date between TO_DATE ('2020/01/01', 'YYYY/MM/DD') and to_date('2020/12/31','YYYY/MM/DD')
所以基本上我需要表中的所有信息,case_id 是 table_1 上的主键。我怎样才能加入他们以接收所有数据并仅使用 table_1?
中的 WHERE'sPS:表格是在 redshift
上启用的频谱我试过了
Select
x
x
x
FROM table_1
JOIN table_2 ON table_1.case_id = table_2.case_id
Select
x
x
x
FROM table_2
Where table_1.resolved_date between ...
AND table_1.assigned_group...
但是我在第二个 SELECT 语句中似乎出错了
Select
table_1.x,
table_1.x,
table_1.x,
table_2.x,
table_2.x,
table_2.x
FROM table_1
JOIN table_2 ON table_1.case_id = table_2.case_id
Where table_1.resolved_date between ...
AND table_1.assigned_group...