Re: Scroll through records and get match
- From: "Ken Snell \(MVP\)" <kthsneisllis9@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 4 Jul 2006 00:00:39 -0400
Something like this?
SELECT T.[Period], T.[Week]
FROM Tbl_Dates AS T
WHERE T.W_C_Date =
(SELECT Max(Q.W_C_Date)
FROM Tbl_Dates AS Q
WHERE Q.W_C_Date <= Date());
--
Ken Snell
<MS ACCESS MVP>
"Andrew" <Andrew@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BDB7293F-24FB-490A-8929-413F49185778@xxxxxxxxxxxxxxxx
Hi Ken,
Thanks for replying.
Hi Ken,
Thanks for replying.
I used the Animal table as an example to try and get a simple answer.
Then
with the reply I was going to adapt it to my requirements.
The real requirement is to get the period from the following table names
Tbl_Dates:
W_C_Date Year Season Month Period Week
02/07/06 2006 W July 12 1
09/07/06 2006 W July 12 2
16/07/06 2006 W July 12 3
23/07/06 2006 W July 12 4
30/07/06 2006 S August 1 1
06/08/06 2006 S August 1 2
13/08/06 2006 S August 1 3
20/08/06 2006 S August 1 4
I want the period (12) and week (4) if today's date [date()] is 25/07/06.
I'm sorry if I confused you by saying to scroll through.
I'm wanting to pass the value of Period and Week through to some more SQL
(I
have this part working!!!!!)
Thanks Ken
--
Andrew
"Ken Snell (MVP)" wrote:
The query's SQL statement to do this would be
SELECT Animal FROM Tbl_Table
WHERE W_C_Date = Date();
Not sure under which scenarios you want to loop through the data? Can you
explain a bit more about your setup and what you want to do?
--
Ken Snell
<MS ACCESS MVP>
"Andrew" <Andrew@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0DF5517E-C204-4F15-A937-17F9C39DE37A@xxxxxxxxxxxxxxxx
Hi,
I have a table (Tbl_Table) in the following format:
W_C_Date Animal
02/07/06 Cat
09/07/06 Dog
16/07/06 Fox
etc
etc
etc
Can someone please provide me with the SQL to loop through and find the
Animal based on todays date. If todays date is 02/07/06 the answer is
Cat.
If todays date is 03/07/06 the answer is Cat. If todays date is
09/07/06
the
answer is Dog.
Thanks in advance
--
Andrew
040706
.
- Follow-Ups:
- Re: Scroll through records and get match
- From: Andrew
- Re: Scroll through records and get match
- References:
- Re: Scroll through records and get match
- From: Ken Snell \(MVP\)
- Re: Scroll through records and get match
- From: Andrew
- Re: Scroll through records and get match
- Prev by Date: Re: ADP SQL DATE SYNTAX PROBLEM
- Next by Date: Re: Scroll through records and get match
- Previous by thread: Re: Scroll through records and get match
- Next by thread: Re: Scroll through records and get match
- Index(es):
Relevant Pages
|