L
Lance
My subject is a mess, i apologize...
I have a dataset which I am searching by two fields, season and week...
Season is an endless number increasing once every 16 weeks. Weeks loops
from 1-16 for each season. My goal is to write a query which will
search "backwards" x periods depending upon what I request. I have my
query running fine except for one problem: When I am searching the
beginning of a season (say from Season 2, week 2, through Season 1,
week 14), I am not getting the upper weeks of season 1. the problem is
the way my query is set up - but I am not sure how to fix it to resolve
this problem (Both fields are numbers, which might be a probem in
itself)
SELECT DISTINCT season, week
FROM incomeTable
WHERE ((season<=2) AND (week<=3))
ORDER BY incomeTable.season DESC , incomeTable.week DESC
As you can see in this example, I will get Sn 2: Wk3: through Sn 2:
Wk1, but it won't loop to Sn 1: Wk: 16 because of the way the week
criteria is set up...
I tried to combine the two, so that it would be season & week < 23, but
then 116 would be greater, and still doesn't show up. I thought about
trying to insert a zero in front of the single digit weeks, but I have
no idea how I would go about doing that. Any advice would be greatly
appreciated. (also, this query is generated in VBA given criteria from
somewhere else, so if you have an idea of how to write the query usign
VBA, that would be even better!)
Lance
I have a dataset which I am searching by two fields, season and week...
Season is an endless number increasing once every 16 weeks. Weeks loops
from 1-16 for each season. My goal is to write a query which will
search "backwards" x periods depending upon what I request. I have my
query running fine except for one problem: When I am searching the
beginning of a season (say from Season 2, week 2, through Season 1,
week 14), I am not getting the upper weeks of season 1. the problem is
the way my query is set up - but I am not sure how to fix it to resolve
this problem (Both fields are numbers, which might be a probem in
itself)
SELECT DISTINCT season, week
FROM incomeTable
WHERE ((season<=2) AND (week<=3))
ORDER BY incomeTable.season DESC , incomeTable.week DESC
As you can see in this example, I will get Sn 2: Wk3: through Sn 2:
Wk1, but it won't loop to Sn 1: Wk: 16 because of the way the week
criteria is set up...
I tried to combine the two, so that it would be season & week < 23, but
then 116 would be greater, and still doesn't show up. I thought about
trying to insert a zero in front of the single digit weeks, but I have
no idea how I would go about doing that. Any advice would be greatly
appreciated. (also, this query is generated in VBA given criteria from
somewhere else, so if you have an idea of how to write the query usign
VBA, that would be even better!)
Lance