In the table 'organization' I have the name of the organizations (organization.name).
In the table 'client_order' I have an ID for the client (client_order.client_id) and for the workshop working on the client order (client_order.opeq_id).
How can I get both organization names in my query?
This is my query:
organization.name as Client, client_order.opeq_id as Atelier_OPEQ,
client_order.ordernumber as Commande_OPEQ,
client_order.alternateorderreferencenumber as Commande_client,
client_order.rma as RMA,
client_order.orderstatus as Etat_de_la_commande,
client_order.datecreated as Date_de_la_demande,
client_order.shipmentdate as Date_de_livraison,
product.description as Produit,
client_order.project_id as Projet FROM
left join organization on organization.id = client_order.client_id left join client_order_product on client_order_product.clientorder_id = client_order.id left join product on client_order_product.product_id = product.id
client_order.datecreated > '2018-10-01' AND organization.cfs_group_id =1
With this query I get the name of the client and the ID number for client_order.opeq_id, I wiish to replace the ID number of client_order.opeq_id with the name of the workshop in 'organization.name'.