View Single Post
  #2  
Old May 11th, 2010, 05:23 PM posted to microsoft.public.access.queries
CBender
external usenet poster
 
Posts: 23
Default Ranking based on Multiple Data Fields

Sorry, After reading my post I feel I need to clarify a couple of things.

I need the ranking to sort on the [Type2] value, then by [Host DN] value,
then by the [All BO] value.

This should provide somewhat of a stepping effect for the reporting as shown
below:

[Rank] [Host DN] [All BO]
[Type2]
1 3,293,090.80 458
3
2 173,563.20 214
3
3 1,029,110.22 8
2
4 877,394.54 6
2
5 3,090.80 218
1
6 2,450.38 188
1
7 15,578.32 65
7 15,578.32 65
8 9,824.67 57
9 548.14 38

I know that where duplicate values are reported duplicate ranking will be
listed and this is what I want.

I hope this clarified what I am looking to try and do.



Thanks,

--
Chip


"CBender" wrote:

I am trying to Rank a field based on multiple sort criteria. My query sorts
correctly, but the Ranking assignments are not correct. Could someone please
review my SQL query and let me know how to correct this problem?

I need to sort Descending by [Type2] AS WELL AS Descending by [Ext B/O]



I used the following to assign my [Type2] field data:

Type2: IIf([All BO]=100 And [Host DN]=20000,3,(IIf([Host
DN]=20000,2,(IIf([All BO]=100,1)))))


I am currently using the following to create my Ranking:

Rank: (SELECT Count([VT].[Ext BO]) FROM [tmp_tbl_Chart5a_1] AS VT WHERE
VT.[Ext BO] tmp_tbl_Chart5a_1.[Ext BO])+1


I know the Ranking I used sorts ONLY on the [Ext BO] field but I am not a
coder and do not know how to modify the format of my query to get what I need.


Can someone please help??


Thanks,
--
Chip