V
V
VoRoN19992020-04-21 17:39:07
SQL
VoRoN1999, 2020-04-21 17:39:07

How to write a query to the database?

There are 3 tables:
--users
-id
...

--table1 (there can be several entries with the same user_id, all works are added together)
-id
-user_id
-event_id
-participation_id
-individuality_id

--table2
-id (event_id is attached to it , participation_id, individuality_id)
-coefficient - there will be a number.

I need to get the first 5 users who have the highest product of all three coefficients.
Also, each user should be able to display the product of the coefficients.
I am using Laravel 6x

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-04-21
@VoRoN1999

Well , join table2 three times under different aliases and you will have three coefficients at once.
What is the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question