ONE TO ONE LEFT EXTERNAL CONNECTION

I was wondering if there is a way to make my one and only outer join:

I need a join that matches table A of table A with table B, for each record in table A she should look for her pair in table B, but there is only one record matching this condition, so when she finds her pair on B, he should stop and continue the next line in table A.

I have a simple LEFT EXTERNAL UNION.

select *  from A LEFT OUTER JOIN B ON A.ID = B.ID ORDER BY (NAME) ASC

Thanks in advance!

+3
source share
2 answers

The syntax you represent in your question is correct. There is no difference in requesting a connection to each other than to one-to-many.

+3

SQL . -, . -, , ?

, , , - :

SELECT * 
From tableA
left outer join 
(select b.* from tableb b1
join (Select min(Id) from tableb group by id) b2 on b1.id - b2.id) b
on a.id = b.id

BUt , , b .

+1

Source: https://habr.com/ru/post/1722365/


All Articles