One of the oracle notes implements the statistics of multiple fields (multiple counts) in a table
the
Requirements: Count the total number of work orders, the total number of unprocessed work orders, the total number of completed work orders, and the total number of unfinished work orders in the WAIT_ORDER table.
the
Table structure: For the convenience of examples, the WAIT_ORDER table has only two fields, namely ID and STATUS, where STATUS is the status of the work order.
1 means unprocessed, 2 means completed, 3 means total outstanding.
the
SQL:
[sql]
SELECT
COUNT(B.ID) AS The total number of work orders,
COUNT(CASE
WHEN B.status IN ('1') THEN
'un_deal' www.2cto.com
END) Total Open Work Orders,
COUNT(CASE
WHEN B.status IN ('2') THEN
END) total number of completed work orders,
COUNT(CASE
WHEN B.status = '3' THEN
END) Total Open Work Orders
FROM WAIT_ORDER B
the
The result is as follows:
the
the
the
Author baolong47
One of the oracle notes implements the statistics of multiple fields (multiple counts) in a table
This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/one-of-the-oracle-notes-implements-the-statistics-of-multiple-fields-multiple-counts-in-a-table/