I have three tables. Users - Documents - Connections
Users is just users.
Documents have id’s and names, among other things.
Connections is a giant list of userID’s and their corresponding documentID (each user has multiple rows connecting them with different documents)
I want to query a big list of document NAMES associated with a given userID.
Is there any way to do this without creating 100 queries?
Right now I have:
select docID from connections where userID = x
then I have PHP generate a bunch of queries in a for-loop using the docIDs from the first result in the form of:
select docName from documents where docID= varFromFirstResult
There must be a way to consolidate this into a single query. Can anyone help!?