Home Forums SQL Server 2008 SQL Server 2008 - General Identify duplicate records where all fields, except one field, are the same. RE: Identify duplicate records where all fields, except one field, are the same.

  • based on Sean's post, i think if you join the grouping back to the original table, you can at least see the dupes :

    SELECT #mx.bid_price_old, #mx.* FROM #mx

    LEFT OUTER JOIN (

    select item_num, pack, item_size, old_desc1, manufacturer_item_nbr, brand_name, opco_desc, flag,

    COUNT(distinct bid_price_old) as bidCount

    from #mx

    group by item_num, pack, item_size, old_desc1, manufacturer_item_nbr, brand_name, opco_desc, flag )

    myAlias

    ON #mx.item_num = myAlias.item_num

    AND #mx.pack = myAlias.pack

    AND #mx.item_size = myAlias.item_size

    AND #mx.old_desc1 = myAlias.old_desc1

    AND #mx.manufacturer_item_nbr = myAlias.manufacturer_item_nbr

    AND #mx.brand_name = myAlias.brand_name

    AND #mx.opco_desc = myAlias.opco_desc

    AND #mx.flag = myAlias.flag

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!