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

Need help: "Outputing a date range from a query"

Status
Not open for further replies.

lminmei

Programmer
Feb 1, 2000
111
0
0
US
I have a query from a database with records that contain dates<br>on my output page..i want to display a range: <br>(earliest date from query) to (last date from query)<br><br>how would i go about doing this?
 
<FONT FACE=monospace><b>&lt;cfset date1=&quot;1/1/2000&quot;&gt;<br>&lt;cfset date2=&quot;6/1/2000&quot;&gt;<br><br>&lt;cfquery datasource=&quot;mydb&quot; name=&quot;daterange&quot;&gt;<br>SELECT * FROM MyTable<br>WHERE Date &gt; '#date1#'<br>AND Date &lt; '#date2#'<br>&lt;/cfquery&gt;</b></font><br><br>Hope this helps...
 
Use order by in your select statement and then in you rcfoutput, set the start date from the first record and the end date from the last record.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Regards,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dave Joyce<br><br>
 
Dave,<br><br>How would I go about setting the start date to the first record and the end date to the last record?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top