• Unless your database is case-sensitive, you don't need the UPPERs.

    Also you should always qualify your tables with their schema.

    So I've rewritten your query a little to account for the above.

    with Sub1

    as (

    select Number_of_Leaves = (

    case

    when f.newact = 'N'

    then c.numberofleavesnew

    when f.newact = 'R'

    then c.numberofleaves

    end

    )

    ,f.STRT_SER

    from dbo.finacle_upload_detail f

    join dbo.cheque_master c on c.schemecode = f.schcd

    )

    select s.Number_of_Leaves

    ,s.Strt_Ser

    ,Tot = s.Number_of_Leaves + s.Strt_Ser

    from Sub1 s

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.