答案 0 :(得分:1)
试试这个
select
decode
(row_number() over(partition by id order by column1, column2),1, id, null)
ids , column1, column2
from table1
相同的逻辑适用于两个相关的表:
select
decode
(row_number()
over(partition by table2.id order by table2.column1, table2.column2),
1, table1.id, null)
ids , table2.column1, table2.column2
from table1 left join table2 on table1.id=table2.id
答案 1 :(得分:0)
您可以像这样使用LEFT JOIN
:
SELECT
A.prop
,B.prop
FROM
A
LEFT JOIN B
ON A.related_field = B.related_field