Answer the question
In order to leave comments, you need to log in
How to build a query in MySQL?
Good day, friends and comrades!
Can you please tell me how to make such a request purely in SQL, as well as in Laravel in the controller?
The task is this, there are two
tables 1 table - Users, in it, for example, columns - id, name, age (age), ref_id (user id in the same table, which is above this user), group_id (which group the user belongs to)
2-table - Groups, it has columns - id, name
Well, in fact, you need to make such a request to select users whose age is greater than the user specified in their ref_id, while selecting the fields - name, age, and also specify the name of the group to which belongs to this user.
table examples:
1 table:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question