ACC: How to Use a Query to Filter Unique DataID: Q90809
|
Novice: Requires knowledge of the user interface on single-user computers.
When you want to filter a table to eliminate duplicate data, you need to
use a query that uses one of the aggregate (totals) functions, such as
First(), Last(), Min(), or Max(), in the fields that do not contain the
duplicate data. The fields that contain the duplicate data should contain
the GroupBy() function.
NOTE: A demonstration of the technique used in this article can be seen
in the sample file, Qrysmp97.exe. For information about how to obtain
this sample file, please see the following article in the Microsoft
Knowledge Base:
Q182568 ACC97: Microsoft Access 97 Sample Queries Available on
MSL
For example, suppose you import an inventory table from an application and
discover that the data has duplicates in it. Your goal is to get the data
back down to a baseline, such as one record per product, so that you can
then re-inventory and have a correct and complete set of data. You can use
a query to filter the data.
Your table might look like this:
ProdID Description Cost MarkUp Quantity
------------------------------------------------
1 A Product $1.50 0.5 10
2 B Product $2.50 0.7 100
3 C Product $1.59 0.9 25
2 D Product $4.59 0.8 30
5 E Product $1.99 0.7 40
6 F Product $2.69 0.4 60
9 G Product $4.95 0.8 20
8 H Product $6.79 0.9 32
9 I Product $6.89 0.7 0
1 J Product $2.99 0.5 11
ProdID Description Cost MarkUp Quantity
-----------------------------------------------
1 A Product $1.50 0.5 10
2 B Product $2.50 0.7 100
3 C Product $1.59 0.9 25
5 E Product $1.99 0.7 40
6 F Product $2.69 0.4 60
8 H Product $6.79 0.9 32
9 G Product $4.95 0.8 20
Additional query words: delete
Keywords : QryTotal
Version : 1.0 1.10 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 11, 1999