我有这个选择声明:
select *
from users u
where u.user_id in (
select distinct user_id
from user_filial
where filial_id in (
select filial_id
from user_filial
where user_id = 101
)
);
我需要将其转换为与Joins的声明。
答案 0 :(得分:1)
SELECT U.*
FROM
users U
INNER JOIN user_filial UF ON UF.filial_id = U.filial_id
WHERE U.user_id = 101
答案 1 :(得分:0)
这是使用连接表示的等效查询:
select distinct u.*
from user_filial uf
join user_filial uf2 on uf2.filial_id = uf.filial_id
join users u on u.user_id = uf2.user_id
where uf.user_id = 101