Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

how to increment count when GROUP by is used

Avatar of chaitu chaitu
chaitu chaituFlag for India asked on
Oracle Database
5 Comments1 Solution623 ViewsLast Modified:
SNO column should be incremented depending upon the total records to be fetched.if i get 4 records then sno numbers should be 1,2,3,4.i dont want to put rownum also in the GROUP BY clause.how to increment the serial number?
SELECT JC.A,
             ROWNUM SNO, --serial number
             JC.B,
             SUM(CHR.AMOUNT),
             SUM(CHR.FINALAMOUNT),
             JC.C,
             JC.D,
             JC.E,
             JC.F,
             JC.G
        FROM CHARGES CHR
       WHERE JC.B = '12111'
         AND JC.STATUS = 'INVOICED'
       GROUP BY JC.A, JC.B, JC.C, JC.D, JC.E, JC.F, JC.G;