473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Return unique records from a table with duplicate records.

Zwoker
66
Greetings everyone,

I have a problem that I hope has a simple solution. I am using MS Access 2003.

I have a table that is a list of financial transactions. I am using a make table query over that table, and want to return a single record where multiple exist for the five fields that are keys on the table. The rule as to which record I want returned where many exist is to use the record with the most recent transaction date (a field on the transaction table).

I named the five key fields first in the query, and sorted by them. I have used Max(transaction_date) field in the query (and set that to ascending in the sort too), with every other field being set to Group_By, and set the Unique Fields property to Yes in the query properties.

But, I still get duplicate records created in my new table.

One obvious cause that I don't seem to be able to (easily) avoid is that I want more fields extracted in my make table query than just the ones I have named. These fields are things like Payment Amount, so each will likely be different, leading to the Unique Fields property not doing what Iike would like it to do.

One final complication: I only want transactions of a certain type, so I have a criteria set in one of the extra (non-key) fields.

Is there an option in MS Access that I haven't set that I should? Is my expectation that Max will cause MS Access to only retrieve record with the latest transaction date wrong?


Thanks for any suggestions.
Nov 18 '07 #1
2 3519
Rabbit
12,516 Expert Mod 8TB
Create a query that returns the unduplicated records with only the key fields. And create a second query that will join that query back to the original.
Nov 19 '07 #2
NeoPa
32,556 Expert Mod 16PB
I can probably help with this but I'm sure I will understand better what you have and what you require if you post a copy of the SQL you are currently using.
That will include the names of all the fields (which I don't know from your post) as well as how you see the data fitting together.
Nov 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Tony Clarke | last post by:
Hi, I'm trying to write a system thats used for about 50 clients that uses html forms and php to log details. The problem is that when a client loads the form page it's given a value which is...
10
by: KENNY L. CHEN | last post by:
Dear experts, I have two tables in my Oracle 8i database: TEST (COL1,COl2,REC_NO) and TEST1 (COL1,COL2,REC_NO). Both tables are unique-indexed on (COL1,COL2,REC_NO). I think the following...
3
by: Bob | last post by:
Why, in the process of creating a unique index, does SQL Server allow me to select the "Ignore duplicate keys" option? Wouldn't I just create a non-unique index if I wanted to ignore duplicate...
2
by: grist2mill | last post by:
I have a table 'Group2Operation' that stores many to many relations between the 'Group' table and the 'Operation' table (each group is has permission to perform one or more of the available...
8
by: Kragen Sitaker | last post by:
ERROR: Cannot insert a duplicate key into unique index pg_class_relname_nsp_index We've been getting this error in our application every once in a while --- typically once an hour to once a day,...
0
by: David Garamond | last post by:
postgresql 7.4.0, redhat 7.3 (under vmware 4.0 on win2k) Windows crashed and some of the files on Redhat got corrupted, including some files in /var/lib/pgsql/data/pg_xlog/. When I tried to start...
1
by: anonieko | last post by:
> This is a common problem with some solution > > /*********************************************************************************** * * Problem: * Determine the Duplicated Records in a...
10
by: mscurto | last post by:
What is the syntax for an sql command to get the following. I want to pull in a handful of fields from a table but one of the fields needs to be unique. For example, if I have a customer table...
6
by: Alvin SIU | last post by:
Hi all, I have a table in Db2 v8 like this: Team Name Role ------ -------- --------------------- A Superman Leader A Batman Member A WonderWoman Member B ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.