dbTalk Databases Forums  

Help to write a query

comp.databases.ms-access comp.databases.ms-access


Discuss Help to write a query in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
foutuguy@gmail.com
 
Posts: n/a

Default Help to write a query - 01-23-2008 , 03:27 AM






Hello,
I have a database in MS Access containing 2 tables:
the first one called "weeks" has 4 columns: id, week number (ex:
2007/01), start date(ex:01/01/2007), end date(ex: 07/01/2007)
the second one is called "tests" and has 5 columns: index, date, name,
test name, duration

my goal: I want to make a query to get rows containing 3 columns:
week number,
name,
dates = date1, date2, etc.,
tests=test1, test2, etc.,
total duration of test for the given week and given person

To be clear, I am trying to get per week a summary of names with the
tests they did and how long total it lasted. The first tables is just
here to get the week number, given the test date.
My current query returns a list of all tests (table 2) with an added
column of the week number and looks like this:

SELECT date, initials, test, [hours outside 8-19], [Week number] FROM
tests, weeks WHERE date BETWEEN [start date] AND [end date]

I tried lots of things but does not know to get to my goal. Could
someone please help me?

Any help will be appreciated. Thank you in advance

Pierrot

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Help to write a query - 01-23-2008 , 09:00 AM






foutuguy (AT) gmail (DOT) com wrote:

Quote:
Hello,
I have a database in MS Access containing 2 tables:
the first one called "weeks" has 4 columns: id, week number (ex:
2007/01), start date(ex:01/01/2007), end date(ex: 07/01/2007)
the second one is called "tests" and has 5 columns: index, date, name,
test name, duration

my goal: I want to make a query to get rows containing 3 columns:
week number,
name,
dates = date1, date2, etc.,
tests=test1, test2, etc.,
total duration of test for the given week and given person

To be clear, I am trying to get per week a summary of names with the
tests they did and how long total it lasted. The first tables is just
here to get the week number, given the test date.
My current query returns a list of all tests (table 2) with an added
column of the week number and looks like this:

SELECT date, initials, test, [hours outside 8-19], [Week number] FROM
tests, weeks WHERE date BETWEEN [start date] AND [end date]

I tried lots of things but does not know to get to my goal. Could
someone please help me?

Any help will be appreciated. Thank you in advance

Pierrot
You might want to consider a DLookup() to get the week number. TestDate
is from table Tests. S/EDate from Weeks.

SELECT Tests.*, DLookUp("WeekNum","Weeks","SDate <= #" & [Testdate] & "#
And EndDate >= #" & [Tdate] & "#") AS Week
FROM Tests

desenchantee
http://www.youtube.com/watch?v=x65k9dQScT8



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.