I have a query to find relationships in a table named entryEntryPairs:
if (!$result = $mysqli->query(
"SELECT entryIdA AS relatedId FROM entryEntryPairs WHERE entryIdB = ".$inRow["id"].
" UNION ".
"SELECT entryIdB AS relatedId FROM entryEntryPairs WHERE entryIdA = ".$inRow["id"]
)) return "Something went wrong";
However, what I really want is to use all of the relatedId
s as part of a larger query to a table named entry. Something of the form:
SELECT title FROM entry WHERE id =
The missing section to the right of id =
would be all of the relatedIds
. Can this be done in a single larger query or do I have to iterate over the results of the first query plugging in each relatedId
to the right of id =
?