Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date range lookup

Status
Not open for further replies.

NEveritt

MIS
Dec 30, 2002
25
0
0
GB
I am looking for the best way to do the following:

Each case in my database has a timestamp. Each date is part of an accounting month. This month does not correspond to the normal months.

Therefore during the select statement I am looking to bring out the relevant book month for that date. For example from a table below:

ID | Month | FromDate | EndDate
1 | 012003| 01/01/03 | 01/02/03
2 | 022003| 02/02/03 | 03/03/03

The field I want to bring into the select is the Month field.

How will I do this?

N
 
SELECT LEFT(MONTH,2)
FROM TABLENAME
WHERE @DATEVARIABLE BETWEEN FROMDATE AND ENDDATE

WILL THIS WORK?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top