Populating a dropdown from a complex query

arcadeicons

Member
I need to populate the values of a cascading dropdown element from the following query...

Code:
SELECT add_tournament_repeat_guests.guestID
FROM add_tournament_repeat_guests
JOIN add_friends
ON add_friends.friend_id = add_tournament_repeat_guests.guestID
WHERE add_tournament_repeat_guests.parent_id = 18 AND add_tournament_repeat_guests.guestID = 633
OR add_friends.venue_owner = 633
GROUP BY guestID

I have it to the point where I am retrieving the all the guestIDs from add_tournament_repeat_guests filtered by the parent_id which I trigger in my 'watch' field.

I need the filters to say 'only show guestID from the the tournament guests table if the user is me OR if the user is in my friends list'

userID = {$my->id} is working fine

OR add_friends.venue_owner ={$my->id} errors unknown column
 
Last edited:
Well, you can't join additional tables to the built in query for the CDD. So you'll have to use a subquery in the WHERE filter.

WHERE {thistable}.id IN (your select statement with join here that returns the id's)

Sent from my HTC6545LVW using Tapatalk
 
Back
Top