Need distinct sum

  • Hi ,

    I have a table with two columns CompanyID,Earnings.

    Table ::

                  CompanyID     Earnings

                      1                  10

                       1                 20

                      2                   15

    I want sum of sum of earnings according to company i.e

                  CompanyID       Earnings

                      1                    30

                      2                    15   

    I have tried using Distinct and GROUP BY, but I didn,t got the answer.

    Reply me asap.

    with regards,

    Kishore

     

  • Select CompanyID, SUM(Earnings) as Earnings From dbo.Companys GROUP BY CompanyID

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply