Bulk updation

  • Dear All;

    I have to update the bulk record for mismatch column's , i did use this qry

    --update stbl set EXTMARK=MARK FROM

    (

    SELECT A.REGISTERNO,SUM(A.EXTERNALMARK) [MARK],SI.EXTMARK FROM

    (

    SELECT PTEMD.REGISTERNO,OESM.EXAMSCHEDULEID,OESM.BATCHID,OESM.COURSEID,PTEMD.EXTERNALMARK FROM

    pted PT

    INNER JOIN Ptemds PTEMD ON PT.PSID=PTEMD.PSID

    INNER JOIN oesm OESM ON OESM.OFFLINEESID=PT.OFFLINEESID

    WHERE 1=1

    AND OESM.COURSEID='080510001'

    AND PTEMD.EXTERNALMARK IS NOT NULL

    ) AS A, stbl SI

    WHERE SI.REGISTERNO=A.REGISTERNO AND SI.COURSEID=A.COURSEID

    AND A.EXAMSCHEDULEID=SI.EXAMSCHEDULEID AND A.BATCHID=SI.BATCHID

    GROUP BY A.REGISTERNO,SI.EXTMARK

    HAVING SUM(EXTERNALMARK) <> EXTMARK

    AND SUM(EXTERNALMARK) < 100

    AND EXTMARK < 100

    Msg 102, Level 15, State 1, Line 18

    Incorrect syntax near '100'.

    I have update the Value for external mark column , error has occured

    kindly any one help this query

    Thanks;

    Rahuman .A

  • HI..

    It seems like some Syntax error in ur SQL..Please go through once again.

    Regards

    Varun R

    http://www.sqlinfo.in

  • U missed the brace and alias name....

    Check with the following Syntax.....

    update stbl set EXTMARK=MARK FROM

    (

    SELECT A.REGISTERNO,SUM(A.EXTERNALMARK) [MARK],SI.EXTMARK FROM

    (

    SELECT PTEMD.REGISTERNO,OESM.EXAMSCHEDULEID,OESM.BATCHID,OESM.COURSEID,PTEMD.EXTERNALMARK FROM

    pted PT

    INNER JOIN Ptemds PTEMD ON PT.PSID=PTEMD.PSID

    INNER JOIN oesm OESM ON OESM.OFFLINEESID=PT.OFFLINEESID

    WHERE 1=1

    AND OESM.COURSEID='080510001'

    AND PTEMD.EXTERNALMARK IS NOT NULL

    ) AS A, stbl SI

    WHERE SI.REGISTERNO=A.REGISTERNO AND SI.COURSEID=A.COURSEID

    AND A.EXAMSCHEDULEID=SI.EXAMSCHEDULEID AND A.BATCHID=SI.BATCHID

    GROUP BY A.REGISTERNO,SI.EXTMARK

    HAVING SUM(EXTERNALMARK) <> EXTMARK

    AND SUM(EXTERNALMARK) < 100

    AND EXTMARK < 100

    ) AS stbl

    :-):-):-)

    Cheers!

    Sasidhar Pulivarthi

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

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