1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

Updating 2 rows with just 1 row of data?

Discussion in 'SQL - Questions and Answers' started by simon, Oct 12, 2006.

  1. simon Guest

    Dialect: SQL 92
    In 1 table I have duplicate rows which I can select via a query so I know which ones are the duplicates.

    However i have now merged these 2 rows into 1 via another query

    SELECT TOrder_NO, TPart_NO, SUM(TOrder_Qty) AS Expr1
    FROM dbo.tblTransitCiPe
    GROUP BY TOrder_NO, TPart_NO
    HAVING (COUNT(*) > 1)


    But now I want to be able to insert/update the results of the above query into my orginal table so that where there are 2 rows on the same data these 2 rows will be deleted and replaced with the 1 row from the query above.

    cheers for any help

Share This Page