Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2007, 05:28 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default query statement

 am trying to build a database and need a query build to count times example
Hound Number 999 score 35 Time 11:00
Hound Number 999 score 30 Time 11:05
Hound Number 999 score 25 Time 11:40

i need it to look at the time and anytime that is within 10 minutes of each
other i don't want it to count, but it has to be able to not count the lowest
score for example from the above example
it should keep theses scores
Hound Number 999 score 35 Time 11:00
Hound Number 999 score 25 Time 11:40


Can someone help me please

Thanks
Larry


 
Old March 8th, 2007, 12:41 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Here is an important parameter: "anytime that is within 10 minutes of each other."

Does this mean that you want to look at the results in 10 minute increments, and take the highest score (or eliminate the lowest score) for each ten minute increment, like:

Hound Number 999 score 35 Time 11:00
Hound Number 999 score 30 Time 11:05
Hound Number 999 score 25 Time 11:40
Hound Number 999 score 35 Time 11:41
Hound Number 999 score 30 Time 11:42
Hound Number 999 score 25 Time 11:43

Yields (just takes highest):

Hound Number 999 score 35 Time 11:00
Hound Number 999 score 35 Time 11:41

OR, yields (just eliminates lowest):

Hound Number 999 score 35 Time 11:00
Hound Number 999 score 35 Time 11:41
Hound Number 999 score 30 Time 11:42

Or, even more difficult, takes each record, compares it to every other record, and if any other record is within 10 minutes, it takes the highest or eliminates the lowest. Which is a huge problem if you are getting results every minute or less, or even within 5 minutes of each result. For example:

Hound Number 999 score 35 Time 11:00
Hound Number 999 score 30 Time 11:05
Hound Number 999 score 25 Time 11:06
Hound Number 999 score 20 Time 11:11

Would yield (highest):

Hound Number 999 score 35 Time 11:00
Hound Number 999 score 30 Time 11:05

since the first recordis highest within 10 minutes of itself, and the second record is highest within 10 minutes of the 11:11 record.

Are you using a function in some other application that does this? If so, what results is it returning?

This can all be done, but is fairly sophisticated. I hope there is another poster out there with some canned code or an elegant solution. There always seems to be.







mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
IF statement in SQL Pass Through Query Coby Access VBA 3 February 15th, 2008 09:24 AM
If Statement Query rsm42 ASP.NET 1.0 and 1.1 Basics 3 February 18th, 2007 12:04 AM
verify my query statement gilgalbiblewheel Classic ASP Databases 2 July 7th, 2005 01:39 PM
how to remove the query statement? gilgalbiblewheel Classic ASP Databases 8 September 11th, 2004 11:10 AM
SQL statement for query vickriz Access 4 September 24th, 2003 10:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.