Find a record that equals 95% of total records

joehands1980

Registered User.
Local time
Today, 08:13
Joined
May 9, 2013
Messages
10
Hi,
Looking for a bit of advice, I have a database which logs attendances and I am looking to extract a value from a field which equals 95% of the total attendances.

For example I have 160 attendances and I need to know the wait time for the person that equals 95% of 160, in this case the 152nd attender, the wait time is recorded but not sure how to get the database to find 95% of 160 and find this record then display the wait time.

Any help greatly appreciated
 
sort by whatever you method you need, then use a recordset to count to the nth record you need.

There may be a method to get there directly by a query. Maybe select top 8, and use the last record. Something like that.?
 
Thanks for taking time to reply.

I do this manually just now but I am looking to have a query with each day displaying this value automatically as the number of attenders changes daily

01/11/2016 - 55 min wait
02/11/2016 - 75 min wait
03/11/2016 - 69 min wait
 
Not sure if it is relevant but you can order by some value (wait time?) and select top 95% - something like

SELECT TOP 95 PERCENT * FROM mytable ORDER BY waittime

call that query1

then to find the 'bottom' of the list, reverse the order

SELECT TOP 1 FROM query1 ORDER BY waittime DESC
 
Last edited:

Users who are viewing this thread

Back
Top Bottom