I Have Some Proble Can u Help me

  • 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

  • you have too many ')' in the 3rd line.

    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

  • Thank u SSCrazy

    Thanks & Regards
    Sabari

  • UPDATE TR_REC SET LMTD_TRCDMA = (SELECT C.CRT_Cod,

    sum (case when R.Prod_Typ in ('Mobile','Hello','Rdel','Data','HSD') then MRP Else 0 End)/100000

    from TR_REC C inner Join ER_Main E on C.CRT_Cod=E.CRT_Cod inner Join Rch_Vouchsep11 R on E.ER_MDN=R.Donor_MDN

    where C.Clstr_Nm in ('Bengaluru B','Bengaluru W') and Day (Tran_dt) < Day(GetDate()) And C.CH_typ in ('CDIST','DIST','ROR','Modern')

    Group By C.CRT_Cod)

    Where LMTD_TRCDMA = Null

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

    :w00t::w00t::w00t::w00t::w00t:

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

    Error

    Msg 116, Level 16, State 1, Line 1

    Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

    Thanks & Regards
    Sabari

  • Run the SELECT statement on its own - you'll see why you can't use it to update a single column.

    John

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

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