Answer the question
In order to leave comments, you need to log in
How to write an optimal SQL query with a calculated field?
Good afternoon, please help me write an optimal SQL query
, there are three tables:
Answer the question
In order to leave comments, you need to log in
Questions of query optimization do not make sense without specifying the DBMS used.
or
select ..., exists(select null from participations as p on p.user_id = ? and e.id = p.event_id) from events as e
NozhnoNo. It is enough to define there is a "User ID" in "Participants", a subquery, for example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question