One oracle note table allows Statistics of multiple fields (multiple count)

Source: Internet
Author: User

One oracle note table allows Statistics of multiple fields (multiple count: count the total number of tickets in the WAIT_ORDER table, the total number of unprocessed tickets, the total number of completed tickets, and the total number of incomplete tickets. Table Structure: For the convenience of the example, the WAIT_ORDER table has only two fields, ID and STATUS, where STATUS indicates the ticket STATUS.
1 indicates not processed, 2 indicates completed, and 3 indicates the total number of incomplete tasks. SQL: [SQL] select count (B. ID) AS ticket COUNT (case when B. status IN ('1') THEN 'un _ demo' www.2cto.com END) Total number of unprocessed tickets, COUNT (case when B. status IN ('2') THEN 'had _ complete' END) Total number of tickets completed, COUNT (case when B. status = '3' then' un _ complete' END) Total number of unfinished tickets FROM WAIT_ORDER B
Result:
 
Author: baolong47

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.