WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Exclude additional duplicate account numbers

 
   Home -> Office other -> General Discussions RSS
Next:  Grouping by Past and Future Dates  
Author Message
Chuck W

External


Since: May 05, 2009
Posts: 3



(Msg. 1) Posted: Thu Oct 29, 2009 12:37 pm
Post subject: Exclude additional duplicate account numbers
Archived from groups: microsoft>public>access (more info?)

Hi,
I have a query with three fields: MRN which is an account number, Month and
another field called AMI which has values of either D or E. There are
instances where for a given month there will be two records that have the
same MRN and month but one will have D and the second will have an E

MRN Month AMI
1030 7/1/09 D
1030 7/1/09 E
1040 7/1/09 E

I want to write a query that will give me a count of all of the Ds and Es
for a given month but will exclude all records (such as the second one) where
there already is a D for the same MRN (1030). I don't want to exclude
records such as the third record where there is no D value for MRN=1040.

Can someone help?

Thanks,
Back to top
Login to vote
Jeff Boyce

External


Since: Nov 04, 2004
Posts: 2279



(Msg. 2) Posted: Thu Oct 29, 2009 1:05 pm
Post subject: Re: Exclude additional duplicate account numbers [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Chuck

I'll try to paraphrase what you're after ...

Find all the (unique) MRNs per date (by the way, calling a date/time field
[Month] is asking for trouble! Not only is what's stored there not a month,
but a date, but Access treats the word "month" as a reserved word).

For all unique MRN - date combinations, if there's only a "D", show it. If
there's only an "E", show it. If there's both, only show the "D".

Is that a fair paraphrasing?

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.


"Chuck W" <ChuckW.TakeThisOut@discussions.microsoft.com> wrote in message
news:01F3C1CA-48FA-441E-9973-1E9B7D5052AC@microsoft.com...
> Hi,
> I have a query with three fields: MRN which is an account number, Month
> and
> another field called AMI which has values of either D or E. There are
> instances where for a given month there will be two records that have the
> same MRN and month but one will have D and the second will have an E
>
> MRN Month AMI
> 1030 7/1/09 D
> 1030 7/1/09 E
> 1040 7/1/09 E
>
> I want to write a query that will give me a count of all of the Ds and Es
> for a given month but will exclude all records (such as the second one)
> where
> there already is a D for the same MRN (1030). I don't want to exclude
> records such as the third record where there is no D value for MRN=1040.
>
> Can someone help?
>
> Thanks,
>
Back to top
Login to vote
John Spencer

External


Since: Apr 09, 2008
Posts: 737



(Msg. 3) Posted: Thu Oct 29, 2009 5:12 pm
Post subject: Re: Exclude additional duplicate account numbers [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

PERHAPS you can use something like the following.

SELECT MRN, [Month], Min(AMI) as FirstAMI
FROM SomeTable
GROUP By MRN, [Month]

If you are doing this in query design view
== Select View: Totals From the menu
== Change Group by to Min under the AMI field


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Chuck W wrote:
> Hi,
> I have a query with three fields: MRN which is an account number, Month and
> another field called AMI which has values of either D or E. There are
> instances where for a given month there will be two records that have the
> same MRN and month but one will have D and the second will have an E
>
> MRN Month AMI
> 1030 7/1/09 D
> 1030 7/1/09 E
> 1040 7/1/09 E
>
> I want to write a query that will give me a count of all of the Ds and Es
> for a given month but will exclude all records (such as the second one) where
> there already is a D for the same MRN (1030). I don't want to exclude
> records such as the third record where there is no D value for MRN=1040.
>
> Can someone help?
>
> Thanks,
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> General Discussions All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET |
  • IT Support