I am trying to join 3 tables indicate a user has signed up for a show.
shows ( a signup belongs to a show ) / users ( a user belongs to a signup ) / signups
I have tried a Left Join with Shows, but I’m unable to put a condition so it picks the current logged in user. I need all the shows listed and I need to mark the show with the signup of the current user.
I tried . . .
SELECT * FROM
ON shows.id = signups.show_id
WHERE signups.user_id =1
( then I’ll figure out how to write it in CAKEPHP 3 )
$query = $articles->find();
[‘Shows’ => ‘shows’],
[‘shows.id = signups.show_id’],
[‘conditions’ => signups.user_id’]);
The table should look like the table below with x marking the show that has a signup with the current user
show 1 | date of show | X
show 2 | date of show |
show 3 | date of show |
show 4 | date of show | X
any help would be appreciated, I have spent 3 weeks trying every possible way, and I know it’s probably really easy