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.

  • Lowell (12/22/2010)


    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

    This looks like it has potential but is still not showing the 2 different bid prices? For this record the bid prices should be 24.85 and 21.46.??

    24.8537677961.5OZ TOPPING CHOC FUDGE PACKET 24620 JHS PFG-Thoms Proestler Co 24.85