I Have Some Problem in this Query

  • SELECT C.Clstr_Nm,C.CH_typ,

    Sum(C.MTD_TRCDMA) 'MTD_TRCDMA',

    SUM(C.LMTD_TRCDMA)'LMTD_TRCDMA',

    '%Growth' = (Round((CAST(sum(MTD_TRCDMA)AS FLOAT))-(CAST(sum([LMTD_TRCDMA])AS FLOAT)) /(CAST(sum([LMTD_TRCDMA])AS FLOAT,2))))

    from TR_RECHARG C

    Left outer Join ER_Main E on C.CRT_Cod=E.CRT_Cod

    Left outer Join Rch_Vouchsep11 R on E.ER_MDN=R.Donor_MDN

    where C.Clstr_Nm in ('Bengaluru B','Bengaluru W') and Lead_CDMANm not in ('','Terminated')

    Group By C.Clstr_Nm,C.CH_typ

    Order By C.Clstr_Nm,C.CH_typ

    -----------------------------------------

    Error : Msg 102, Level 15, State 1, Line 4

    Incorrect syntax near ','.

    Thanks & Regards
    Sabari

  • Have a close look at your '%Growth' - the ',2' is in the wrong place.

  • Where need to give

    SELECT C.Clstr_Nm,C.CH_typ,

    Sum(C.MTD_TRCDMA) 'MTD_TRCDMA',

    SUM(C.LMTD_TRCDMA)'LMTD_TRCDMA',

    '%Growth' = (Round((CAST(sum(MTD_TRCDMA)AS FLOAT))-(CAST(sum([LMTD_TRCDMA])AS FLOAT)) /(CAST(sum([LMTD_TRCDMA])AS FLOAT,2))))

    from TR_RECHARG C

    Left outer Join ER_Main E on C.CRT_Cod=E.CRT_Cod

    Left outer Join Rch_Vouchsep11 R on E.ER_MDN=R.Donor_MDN

    where C.Clstr_Nm in ('Bengaluru B','Bengaluru W') and Lead_CDMANm not in ('','Terminated')

    Group By C.Clstr_Nm,C.CH_typ

    Order By C.Clstr_Nm,C.CH_typ

    Thanks & Regards
    Sabari

  • It seems like you just reposted the original query.

    Did you even try to follow the hint given by BrainDonor? :unsure:

    What exactly do you mean by "Where need to give"?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

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