• Jay, i am using SQL server 7.0

    Here's the query and the error results:

    DELETE

    FROM WTRDET

    INNER JOIN

    (

    SELECT Order_NBR ,Line_NBR, MAX(Ship_Date) as MaxShipDate

    FROM WTRDET GROUP BY Order_NBR ,Line_NBR

    ) AS dt

    ON WTRDET.Order_NBR = dt.Order_NBR

    AND WTRDET.Line_NBR = dt.Line_NBR

    AND WTRDET.Ship_Date < dt.MaxShipDate

    Error result:

    Server: Msg 156, Level 15, State 1, Line 3

    Incorrect syntax near the keyword 'INNER'.

    Server: Msg 156, Level 15, State 1, Line 7

    Incorrect syntax near the keyword 'AS'.