473,766 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL/Query question - Hard to get head around

I have been working on this for a while, and unless I have missed a
vital part of Access then I think it is very difficult to do.

I have a database with two main tables:
Drivers: Driver Details
DriversData: RecordID, DriverID, WeekEnding, MondayHoursWork ed,
TuesdayHoursWor ked, etc.

I can get a report for a specific person showing the last 17 weeks,
and an average hours per week for this. (I used SELECT TOP 17).

I need a list of drivers and their 17 week averages.

This looks like I need to need to feed list of drivers into another
query? or run another query many times.

Any help gratefully appreciated, even if it is just a keyword to point
me in the right direction.

TIA

Andrew
Nov 13 '05 #1
3 1501
Andrew Fox wrote:
I have been working on this for a while, and unless I have missed a
vital part of Access then I think it is very difficult to do.

I have a database with two main tables:
Drivers: Driver Details
DriversData: RecordID, DriverID, WeekEnding, MondayHoursWork ed,
TuesdayHoursWor ked, etc.

I can get a report for a specific person showing the last 17 weeks,
and an average hours per week for this. (I used SELECT TOP 17).

I need a list of drivers and their 17 week averages.

This looks like I need to need to feed list of drivers into another
query? or run another query many times.

Any help gratefully appreciated, even if it is just a keyword to point
me in the right direction.

TIA

Andrew


Well, you can always determine what the date range is. Look at DateAdd.
For example
? DateAdd("ww",-17,Date())
returns 6/16/2004.

So then you can select records where weekending is between this and that
and group them on driver and weekending.

Much easier than your suggestion.

Nov 13 '05 #2
Andrew Fox,
Dig around for help on nested subqueries. I'd run a subquery that generated
averages for all my drivers and then a wrapper query which only picked the
top 17.

"Andrew Fox" <an*********@ho tmail.com> wrote in message
news:23******** *************** ***@posting.goo gle.com...
I have been working on this for a while, and unless I have missed a
vital part of Access then I think it is very difficult to do.

I have a database with two main tables:
Drivers: Driver Details
DriversData: RecordID, DriverID, WeekEnding, MondayHoursWork ed,
TuesdayHoursWor ked, etc.

I can get a report for a specific person showing the last 17 weeks,
and an average hours per week for this. (I used SELECT TOP 17).

I need a list of drivers and their 17 week averages.

This looks like I need to need to feed list of drivers into another
query? or run another query many times.

Any help gratefully appreciated, even if it is just a keyword to point
me in the right direction.

TIA

Andrew

Nov 13 '05 #3
Thanks for the help so far, I am looking into nested sub queries,
however:

I'll try to restate, I need to create an average from the top 17
records, for each driver.
Using a nested subquery to select the top 17 would result in only 17
records, however I need 17 for each driver.

What I need is a way of saying select these records and group by
driver, but only select 17 records for each driver.

Hope this is clearer.

Andy
"Alan Webb" <kn*****@hotmai l.com> wrote in message news:<I-*************** *****@comcast.c om>...
Andrew Fox,
Dig around for help on nested subqueries. I'd run a subquery that generated
averages for all my drivers and then a wrapper query which only picked the
top 17.

"Andrew Fox" <an*********@ho tmail.com> wrote in message
news:23******** *************** ***@posting.goo gle.com...
I have been working on this for a while, and unless I have missed a
vital part of Access then I think it is very difficult to do.

I have a database with two main tables:
Drivers: Driver Details
DriversData: RecordID, DriverID, WeekEnding, MondayHoursWork ed,
TuesdayHoursWor ked, etc.

I can get a report for a specific person showing the last 17 weeks,
and an average hours per week for this. (I used SELECT TOP 17).

I need a list of drivers and their 17 week averages.

This looks like I need to need to feed list of drivers into another
query? or run another query many times.

Any help gratefully appreciated, even if it is just a keyword to point
me in the right direction.

TIA

Andrew

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
7
3541
by: R0bert Nev1lle | last post by:
Internet Explorer always presents me with a challenge (partial repost). The current issue involves emulating max-width in IE using the technique described by Svend Tofte. http://www.svendtofte.com/code/max_width_in_ie/ The CSS code uses JavaScript expressions and feeds the browser's width to the style. The CSS code follows. * html #Content {
3
5395
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
16
4215
by: Dave Weaver | last post by:
I'm having severe performance issues with a conceptually simple database. The database has one table, containing weather observations. The table currently has about 13.5 million rows, and is being updated constantly. (The database is running on a dual 550MHz PIII with 512MB RAM. I have PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.96 on RedHat 7.2) On the whole, queries are of the form: SELECT ? FROM obs WHERE station = ?
2
2391
by: Mattyboy | last post by:
Guys I have built a database with saved queries that runs fine in Access but when I call it from the web using ASP, an exception occurs. I have tried multiple ways of testing the databases with the following results. www.brinkster.com has a tool on their free asp hosting where you can dump an access .mdb database on there and then run SQL queries against it. Using Access databases it is possible to just call the query by using its...
6
29942
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access newsgroups, the access support centre, I can seem to find no similar situation. I am not using any references, or VBA at all in the first place. I am trying to set up a simple (or so I thought) query to work with the text of two tables. ...
7
3913
by: alf8kitty | last post by:
Hello, Im still very new to php and am having a problem. I return a MySQL query to a form in my php page and I want to be able to export the form data to Excel when the users clicks a link (or a button). I found some code and can apparently export the entire contents of a table in my database, but when i try to limit the export result using variables...i get nothing. I am hoping someone can point me in the right direction? This is the...
4
4586
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
4
9501
by: dizzydangler | last post by:
Hi all, I am a new Access user and just starting to get my head around some of the basic concepts, so please take it easy on me :) My company has been managing client records on excel, and I’m in the process of migrating the data over to Access 2007 (Windows XP), kind of learning as I go. I’ve managed to import the client records into a single table, and set up a “single view” form that streamlines how we input new client data. Now I’m...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.