w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Select all upcoming events where a user participate in

This may do the trick

You will select the responses, filtered by the USER name, and join the event that those responses belong to.

SELECT * FROM `responses`
JOIN `events` ON (
    `events`.`id` = `responses`.`event` AND
    `events`.`deleted` = 0
)
WHERE `responses`.`user` = :USER AND
`responses`.`canceled` = 0

The reason for selecting the responses is because it holds the discriminating column, the user.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.