J
Jamie
Hello,
I hope some can help. I have tried to detail this issue clearly, but
not being sure of the correct functions/sql code to use I apologise if
this post is a bit muddled.
I am trying to drop rows from a query (itself a union of smaller
queries) that contains duplicate fields, however I need to apply a
conditional test against another column to determine the correct row
to drop.
Here is an example of a couple of rows from my query dataset that show
the partial duplications:
CAT Number StockCode Supplier Combi
1234 C1234 Supp2 C1234Supp2
1234 1234 Supp1 1234Supp1
I have applied a SELECT Distinct which drops most duplicates, how ever
the remainder are legitimate. Where there is a duplication of 'CAT
Number', I'm trying to drop the row that contains a specific supplier
value. In this query all the remain duplicates belong to two
suppliers. I am trying to drop the row that belongs to Supp1.
All suppliers have a number of legitimate CAT Number - StockCode
combinations so I am unable to filter on the supplier column. This
query is then used as part of another larger query to add stock code
and supplier details to 'cat number' focused table.
I'd really appreciate any suggestions that can manage this in SQL code
if it's possible. If this isn't possible would my next logical step be
to investigate using VBA?
Thanks in advance,
Jamie
I hope some can help. I have tried to detail this issue clearly, but
not being sure of the correct functions/sql code to use I apologise if
this post is a bit muddled.
I am trying to drop rows from a query (itself a union of smaller
queries) that contains duplicate fields, however I need to apply a
conditional test against another column to determine the correct row
to drop.
Here is an example of a couple of rows from my query dataset that show
the partial duplications:
CAT Number StockCode Supplier Combi
1234 C1234 Supp2 C1234Supp2
1234 1234 Supp1 1234Supp1
I have applied a SELECT Distinct which drops most duplicates, how ever
the remainder are legitimate. Where there is a duplication of 'CAT
Number', I'm trying to drop the row that contains a specific supplier
value. In this query all the remain duplicates belong to two
suppliers. I am trying to drop the row that belongs to Supp1.
All suppliers have a number of legitimate CAT Number - StockCode
combinations so I am unable to filter on the supplier column. This
query is then used as part of another larger query to add stock code
and supplier details to 'cat number' focused table.
I'd really appreciate any suggestions that can manage this in SQL code
if it's possible. If this isn't possible would my next logical step be
to investigate using VBA?
Thanks in advance,
Jamie