Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 29th, 2003, 11:13 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Removing Duplicate Fields

Hi All,

I've been working on this problem for 2 days now and I can't find a solution

I have a database in which looks a little like this

ID Name Address
1 anton 32 algi rd
2 lesly 24 smith st
3 bianca 32 algi rd
4 brian 92 faraday cres
5 bill 32 algi rd.

I want a query that will enable me to display all the names and addresses however if the Address is a duplicate (as in ID's 1, 3, 5) I don't want it to display the address 3 times. I only want it to display once.

However it gets more complicated I want one of the names (either anton bianca or lesley doesn't matter which) to show up with the address.

In other words I want the Query to output

ID Name Address
1 anton 32 algi rd
2 lesly 24 smith st
4 brian 92 faraday cres.

I have tried the

SELECT DISTINCT Address FROM Details

However I need the name and ID's to show up with the address!

Thanks very much in advance,

                                              Anton
Reply With Quote
  #2 (permalink)  
Old November 29th, 2003, 11:54 PM
Authorized User
 
Join Date: Oct 2003
Location: roanoke, va, USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Anton

First create a "totals" Query with
fields ID and Address; using Min in
the Total block for ID.

This will return something like:
ID Address
1 32 algi rd
2 24 smith st
4 92 faraday cres

Now build a second Query tying
the above back to Your origional
table to get A name for each.

Dave

Reply With Quote
  #3 (permalink)  
Old December 1st, 2003, 07:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Following on from Dave's response....
You only need one query, which selects the Min ID, Min Name and GroupBy Address,
For example:
Code:
SELECT Min(id) AS id, Min(Name) AS Name, Address
FROM YourTable
GROUP BY Address;
Steven



I am a loud man with a very large hat. This means I am in charge
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing duplicate edge elements geoGregory3 XSLT 2 February 27th, 2008 06:08 AM
Removing duplicate entries avantikad XSLT 2 January 2nd, 2008 12:29 PM
Removing duplicate Value Row milindsaraswala Excel VBA 0 November 14th, 2007 06:11 PM
Removing duplicate nodes post-process QuickSilver002 XSLT 3 April 4th, 2007 03:47 PM
Removing the Duplicate anukagni Access 3 August 31st, 2006 12:57 AM



All times are GMT -4. The time now is 11:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.