A
A
Alexander2018-09-13 22:26:45
MySQL
Alexander, 2018-09-13 22:26:45

Sampling from a database on 4 tables?

There are five (actually more) tables with lots of data inside.
job client status responsible worker
In status there is a jobID , according to a certain value of this ID, lines should be displayed. Rows must be derived from many tables, because the data is scattered and linked by identifiers. The output is supposedly a loop in PHP.
Also in the status there is a workerID , according to which the worker has a text description.
The job has a clientID , the client has a text description for this clientID .
The job hasresponsibleID , in responsible there is a text description for this responsibleID .
I ask for help in compiling a sql query for such a selection. I just want to get the gist. Diligently I try to smoke join, but nothing efficient comes out. Mb because it's too late...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2018-09-13
@barrty

And what's the problem with just neatly listing everything you need in the request

select 
   ...
from job
join status on status.jobID = job.jobID
join worker on worker.workerID = status.workerID
join client on client.clientID = client.clientID 
join responsible on responsible.responsibleID = job.responsibleID

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question