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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Range in SQL Statement

Status
Not open for further replies.

Neozero

MIS
Jul 7, 2000
49
US
I cannot figure out how to give a date range of 3 months.&nbsp;&nbsp;What I have come up with so far is using the GetDate () but I need to specify my field names to show a date range of 3 months.&nbsp;&nbsp;&nbsp;Any help would be helpful...<br><br><br>Jason<br><br><br><br>
 
If I understand you well, something like this:<br><br>select DateField from ATable<br>&nbsp;where extract(month from DateField) between 1 and 3<br><br>Bye, Otto.<br>
 
I will give you an Oracle solution:<br>SELECT DateField FROM your_table<br>WHERE DateField BETWEEN RefDate AND (ADD_MONTHS(RefDate,3)-1);<br>this query should retrieve date within the range starting with RefDate and ending after 3 months, except last date.<br>I hope this works for you.<br>Regards, <p>Eduard Stoleru<br><a href=mailto:e_stoleru@yahoo.com>e_stoleru@yahoo.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top