how to get Mysql COUNT within subquery -


here have table named test2. need below output single mysql query.i have tried using subquery fail. kindly me sort this.

pending status- 154

completed status - 159

enter image description here

required output

enter image description here

query have tried

select     (         test2.doc_no,         select             (                 count(test2.esn) pending_quantity,                 test2.doc_no                             test2                             test2.sttus = 154             group                 test2.doc_no             ),             select                 (                     count(test2.esn) completed_quantity,                     test2.doc_no                                     test2                                     test2.sttus = 159                 group                     test2.doc_no                 )     ) 

select doc_no, sum(status=154) pending_quantity, sum(status=159) completed_quantity  test2 group doc_no 

try above query.

hope you.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -