ms access - How to handle duplicate values -
i have table 100k plus items. need create table "best prices"
most items have unique supplier, can sourced 2 or 3 different suppliers have same manufacturer part number [mpn].
to find duplicate values have used:
in (select [mpn] [main data] tmp group [mpn] having count(*)>1 ) how handle duplicate records? each duplicated [mpn] want select record both in stock , has lowest price?
table has fields: [ean], [mpn], [inventory number] - field has unique supplier suffix, [name], [cost], [quantity]
thank in advanced!
i try this:
select m1.mpn, m1.[name], m2.qty, max(m1.cost) maxcost, min(m1.cost) mincost [main data] m1 inner join (select [mpn], sum(1) qty [main data] group [mpn] having count(*)>1 ) m2 on m1.mpn = m2.mpn group m1.mpn, m1.[name] this give quantity in stock , highest price, lowest price each item. feel free remove other fields if find them useless.
Comments
Post a Comment