我有一个名为concept-relation
包含 3 列的表
(relationID, firstConceptID, secondConceptID)
我有一个名为concept
包含 2 列的表
(ID, name)
我想获得的名称firstConceptID
和secondConceptID
时间relationID = 22
。
这是我提出的查询。
select * from (
select name as source from concept where concept.ID in (
select firstConceptID from `concept-relation` where relationID = 22
)
) as e,
(
select name as des from concept where concept.ID in (
select secondConceptID from `concept-relation` where relationID = 22
)
)as e
它运作良好,但我想知道执行此类查询的最佳做法是什么?