0

I'm using both MySQL community as well as MariaDB.

I have the following query:

SELECT COUNT(order_id) AS "No of Orders",
       COUNT(po_id) AS "No of Production Orders",
       SUM(po_qty) AS "No of Tools"
  FROM orders
  JOIN production_orders ON po_o_id=order_id
 WHERE order_type="Trial"
   AND (po_status <> "COMPLETED"
   AND po_status <> "GOODS_ISSUED"
   AND po_status <> "PO_TERMINATED"
   AND po_status IS NOT NULL);

I get the following output when I run the query:

No of Orders No of Production Orders No of Tools
271 321 2335

My question is, what should I do to get the output in this way - that is, turning the rows into column values:

Labels Values
No of Orders 271
No of Production Orders 321
No of Tools 2335

Is it even possible to orient the query output this way?

Thanks in advance.

O. Jones
  • 103,626
  • 17
  • 118
  • 172

0 Answers0