I need to create two selects. One for the total and another for bringing all the fields. How do I put 2 selects in the field creation query?
I need to add this total:
After a subselect suggestion, the query looks like this:
SELECT request_id, requests.idient_id, requests.id_product, clients.name AS client_name, products.name AS product_name, products.preco the preco_produto, orders.data, orders.frete, requests.quantity, total.order, (SELECT SUM (total.order) FROM requests) AS sub_total FROM requests INNER JOIN clients ON orders.client_id = clients.clients_id INNER JOIN products ON orders.product_id = products.products_id GROUP BY orders.id orders_id ORDER BY clients.name