A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Comapring rows of a table to multple rows within the same table



 
 
Thread Tools Display Modes
  #1  
Old March 4th, 2010, 02:28 AM posted to microsoft.public.access.queries
Mozee
external usenet poster
 
Posts: 1
Default Comapring rows of a table to multple rows within the same table

Hi,

I have the following data which I have been tasked with identifying a
primary case for each customer. Unfortunately the data contains duplicate
records such as Case 1 and 2. I would be extremely grateful if you could tell
me how can I compare all the rows related to Customer 1 and flag a case as
the primary case.

CaseID, CustomerID, PrimaryStatus, SecondaryStatus, GroupA, GroupB
1,1,New, Unassigned, RU, HK
2,1,New, Unassigned, RU, HK
3,1,In Progress, Normal Review, RU, HK
4,1,New, Unassigned, IN, UK
5,2,New, Assigned, JP,
6,2,In Progress, Special Review, BR, HK
7,2,Complete, Success, , US
8,2,Complete, Success, , HK


I have tried a number of queries and even used Recordsets as part of VBA
procedures but dont seem to be able to figure out how I can compare the cases
for a customer.

Customer 2 scenario is more complicated as I need to be able to pick case 5
and 6 as primary cases. The reason for this is that values in GroupA are
exclusive where is values in GroupB are based on a ranking for example HK is
higher than UK and UK is higher than US. Case 6 is chosen over case 8 even
though they share the same Group B value as Case 6 has a Group A value which
is exclusive.

Going back to the Customer 1, the cases that should be flagged as primary
are 3 and 4. This is because even though case 3 has the same GroupA and B
values, it has progressed further in the workflow. Case 4 is selected as well
as it has a group A value different from case 3. If it had the same value
then case 3 could have been excluded.

Can I write a query to this in SQL in Access and how will this look OR do I
code something in VBA to do this and how would that look?

Please help.

Many thanks,
  #2  
Old March 4th, 2010, 04:33 AM posted to microsoft.public.access.queries
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Comapring rows of a table to multple rows within the same table

Mozee,
please define what "primary" means (well, in the way you are using it). In
addition to your sample data, explain how you determine which cases are
"primary" -- what is the business rule that determines this?

--
Message posted via http://www.accessmonster.com

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.