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
それはうまく機能しますが、そのようなクエリを実行するためのベストプラクティスは何ですか?