473,402 Members | 2,072 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,402 software developers and data experts.

Ranking on multiple fields

Hi I have following problem:
I have a table with following rows:

Nb. Time TimeFlt Faults Refus Total
52 36,44 0,00 0,00 1,00 5,00
56 39,50 0,00 1,00 0,00 5,00
58 30,67 0,00 2,00 0,00 10,00
59 34,68 0,00 1,00 1,00 10,00
60 41,04 1,04 0,00 2,00 11,04
66 39,50 0,00 0,00 1,00 5,00
68 37,54 0,00 2,00 1,00 15,00
71 43,70 3,70 4,00 1,00 28,70
72 36,28 0,00 5,00 1,00 30,00
77 33,20 0,00 1,00 0,00 5,00
83 36,91 0,00 1,00 1,00 10,00
89 38,44 0,00 1,00 1,00 10,00
90 34,96 5,00 0,00 0,00 5,00
91 28,93 0,00 0,00 0,00 0,00
92 45,97 5,97 1,00 2,00 20,97
96 35,86 0,00 0,00 1,00 5,00

I need to get the following result:

Nb. Time TimeFlt Faults Refus Total Rank
52 36,44 0,00 0,00 1,00 5,00 5
56 39,50 0,00 1,00 0,00 5,00 6
58 30,67 0,00 2,00 0,00 10,00 8
59 34,68 0,00 1,00 1,00 10,00 9
60 41,04 1,04 0,00 2,00 11,04 12
66 39,50 0,00 0,00 1,00 5,00 6
68 37,54 0,00 2,00 1,00 15,00 13
71 43,70 3,70 4,00 1,00 28,70 15
72 36,28 0,00 5,00 1,00 30,00 16
77 33,20 0,00 1,00 0,00 5,00 3
83 36,91 0,00 1,00 1,00 10,00 10
89 38,44 0,00 1,00 1,00 10,00 11
90 34,96 5,00 0,00 0,00 5,00 2
91 28,93 0,00 0,00 0,00 0,00 1
92 45,97 5,97 1,00 2,00 20,97 14
96 35,86 0,00 0,00 1,00 5,00 4

To get the correct ranking the sorting order is as follows:

lowest value in Total-Field
lowest value in faults-field
lowest value in refus-Field
lowest value in TimeFlt-field
lowest value in Time-field

I did find the ranking examples but it didn't work on more fields
Sep 12 '16 #1
2 940
Seth Schrock
2,965 Expert 2GB
This isn't the prettiest way, but to have it where the order of the fields matters, what I had to do was to concatenate the fields together as a string into one field and then sort based on that. Someone else may have a better solution, but that is all I could come up with when I tried something similar.
Sep 12 '16 #2
I RonnyGilisen,

you write
  1. lowest value in Total-Field
  2. lowest value in faults-field
  3. lowest value in refus-Field
  4. lowest value in TimeFlt-field
  5. lowest value in Time-field

But considering just a table with 3 fields
  1. Nbr
  2. Total-Field
  3. faults-field

Let's imagine two rows
1 - 10 - 15
2 - 8 - 25

what are the rules to sort them?
Sep 19 '16 #3

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

Similar topics

1
by: mark.reichman | last post by:
First off.. Thanks to Grant Wagner for help in a previous thread related to this one. I am at a total loss... I have multiple fields in a form with the same name. Lets call the fields with the...
2
by: CFW | last post by:
I use the following flawlessly to insert a single field: strSQL = "Insert into (Casket) Values " _ & "(" & conQuote & NewCasket & conQuote & ")" Set db = CurrentDb If MsgBox(NewCasket & " is...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
3
by: mkjets | last post by:
I have worked for hours on trying to find a solution and have not figured it out. I am working in Access 2003. I need to create a query that takes values from 1 table and displays them in...
4
4Him
by: 4Him | last post by:
First off, let me say this is a great site! I've just started working with Access and much of my success is from what I've read here! Background: I have a form, driven off a single table. Goal:...
2
by: Nathan Sokalski | last post by:
I have a Repeater that uses a DataSource that has multiple fields. When the values of these fields is displayed in the Repeater, there are fields that are used in combination with other fields as...
7
by: john.cole | last post by:
I have searched all the groups I can, and I still haven't been able to come up the solution I need. I have the following problem. In my form named sbfrmSpoolList, I am entering a job, spool and...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
32
LeighW
by: LeighW | last post by:
Hi, I'm still having a couple problems with searches. I have a search form, frm_Search. The form I am trying to filter, frm_Form1 An unbound combobox on frm_Search, Cbo_Permit 6 different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.