A
A
Alexander Tokmakov2021-10-22 15:26:45
SQL
Alexander Tokmakov, 2021-10-22 15:26:45

How to write a query in PHP database?

DB tables:

user(id, name) - employee.
object(id,user_id) - the object is attached to the worker. A worker can have multiple objects.
rabota(id,data,object_id,sum) - work is attached to an object. There may be multiple jobs on site.

The task is to find the best employee of the month.
It turns out it is necessary to find all works on all objects workers.
The output should turn out: Peter earned 30,000 rubles.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-10-22
@calliko

JOIN, GROUP BY, SUM(), ORDER BY, LIMIT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question