2
I have two tables: ordem_servico and ordem_servico_tecnicos. If more than one technician is required for an O.S., records of each technician are created in the second related table by the order number(id).
I would like to consult open orders showing the technicians related to it.
SELECT
os.numero_os AS numero_os
FROM
ordem_servico os
WHERE
os.data_servico BETWEEN '$data_cad_i' AND '$data_cad_f'
With subquery gave the error: "Subquery Returns more than 1 Row" because it actually has more than one technique for the same O.S..
It’s not just making one
INNER JOIN
? https://answall.com/questions/6441/qual%C3%A9-a-difference%C3%A7a-entre-Inner-Join-e-outer-Join– Marconi
No. Imagine that where 1234 has technicians A and B, then in the table of ordem_servico_tecnicos There will be two records, one for each technician. What I would like is to have a return line of the service order consultation with the name of the two technicians who will execute it.
– Rafael Silva
Rafael, do you say in the same line? Without repeating the order?
– Marconi
This, the technicians appear on the same line of OS data in one field only, as if they were concatenated.
– Rafael Silva
Try to understand about functions, they can solve your problem.
– Marconi
I corrected my answer in an attempt to help you. Look there.
– Ismael