SQL Query - Pivot with Ranges
In Mysql You can use SUM with an comparision, which returns 1 if the condition uis met or 0 if not.


SELECT
    `BSEG_ID`, `DST_ID`,
    SUM(`BILL_SQ` BETWEEN 0 AND 10) '0-10',
    SUM(`BILL_SQ` &gt; 10 AND `BILL_SQ` &lt;= 20) '10&gt; &lt;= 20',
    SUM(`BILL_SQ` &gt; 20) '&gt;20'
FROM CI_BSEG_CALC_LN
GROUP BY `BSEG_ID`, `DST_ID`


BSEG_ID | DST_ID   | 0-10 | 10&gt; &lt;= 20 | &gt;20
------: | :------- | ---: | --------: | --:
  11111 | REV-WSC  |    1 |         0 |   2
  11111 | REV_WWSC |    1 |         0 |   2
  12334 | REV-WSC  |    1 |         0 |   2
  12334 | REV_WWSC |    1 |         0 |   2




SELECT
    `BSEG_ID`, `DST_ID`,
    SUM(`res_sum` BETWEEN 0 AND 10) '0-10',
    SUM(`res_sum` &gt; 10 AND `res_sum` &lt;= 20) '10&gt; &lt;= 20',
    SUM(`res_sum` &gt; 20) '&gt;20'
FROM
    (SELECT
         `BSEG_ID`, `DST_ID`,
         SUM(`AUDIT_CALC_AMT`) res_sum
     FROM CI_BSEG_CALC_LN
     GROUP BY `BSEG_ID`, `DST_ID`) t1
GROUP BY `BSEG_ID`, `DST_ID`


BSEG_ID | DST_ID   | 0-10 | 10&gt; &lt;= 20 | &gt;20
------: | :------- | ---: | --------: | --:
  11111 | REV-WSC  |    0 |         0 |   1
  11111 | REV_WWSC |    0 |         0 |   1
  12334 | REV-WSC  |    0 |         0 |   1
  12334 | REV_WWSC |    0 |         0 |   1


db&lt;&gt;fiddle here
For ORACLE


SELECT
    BSEG_ID,DST_ID,
     SUM(CASE WHEN BILL_SQ &gt;= 0 AND BILL_SQ &lt;= 10 THEN 1 ELSE 0 END) &quot;0-10&quot;,
     SUM(CASE WHEN BILL_SQ &gt; 10 AND BILL_SQ &lt;= 20 THEN 1 ELSE 0 END) &quot;10&gt; &lt;= 20&quot;,
    SUM(CASE WHEN BILL_SQ &gt; 20 THEN 1 ELSE 0 END) &quot;&gt;20&quot;
    
FROM CI_BSEG_CALC_LN
GROUP BY BSEG_ID, DST_ID


BSEG_ID | DST_ID   | 0-10 | 10&gt; &lt;= 20 | &gt;20
------: | :------- | ---: | --------: | --:
  12334 | REV-WSC  |    1 |         0 |   2
  12334 | REV_WWSC |    1 |         0 |   2
  11111 | REV_WWSC |    1 |         0 |   2
  11111 | REV-WSC  |    1 |         0 |   2




SELECT
    BSEG_ID,DST_ID,
     SUM(CASE WHEN res_sum &gt;= 0 AND res_sum &lt;= 10 THEN 1 ELSE 0 END) &quot;0-10&quot;,
     SUM(CASE WHEN res_sum &gt; 10 AND res_sum &lt;= 20 THEN 1 ELSE 0 END) &quot;10&gt; &lt;= 20&quot;,
    SUM(CASE WHEN res_sum &gt; 20 THEN 1 ELSE 0 END) &quot;&gt;20&quot;
FROM
    (SELECT
         BSEG_ID,DST_ID,
         SUM(AUDIT_CALC_AMT) res_sum
     FROM CI_BSEG_CALC_LN
     GROUP BY BSEG_ID, DST_ID) t1
GROUP BY BSEG_ID, DST_ID


BSEG_ID | DST_ID   | 0-10 | 10&gt; &lt;= 20 | &gt;20
------: | :------- | ---: | --------: | --:
  12334 | REV-WSC  |    0 |         0 |   1
  12334 | REV_WWSC |    0 |         0 |   1
  11111 | REV_WWSC |    0 |         0 |   1
  11111 | REV-WSC  |    0 |         0 |   1


db&lt;&gt;fiddle here