Help please with the compilation of SQL query!
Two parameters are passed to the PHP script:
subject_id- the topic ID of the test;user_id- ID of the user who passed the test and in relation to which it is necessary to calculate the relevance;
Users who have been tested will be many, for this request it is very desirable to make it as optimized as possible.
As a result, you need to get a sample of users sorted by relevance of responses to the topic of testing.
The table with test subjects (subjects):
Table with tests (tests):
Test response table (options):
The table with the answers to each of the tests (answers):



