Date range Look up

  • Thread starter Thread starter sooz9
  • Start date Start date
S

sooz9

If I wanted to run a querry asking "What period do you want to find data
for?" and I typed in "1"

How would the querry know to look up and pull all data for period 1 which
are 1/3/09 to 1/30/09?

Of course my company's periods do not follow the typical monthy calendar
date range
 
Can you build a table that has three fields: period, startdate and enddate?
You could then join that table to your other table along the lines of

SELECT Table1.Field1, Table1.Field2, Table1.Field3, Table1.MyDate
FROM Table1 INNER JOIN PeriodTable
ON Table1.MyDate BETWEEN PeriodTable.StartDate AND PeriodTable.EndDate
WHERE PeriodTable.Period = [What period do you want?]
 
Back
Top