Ask a Question related to Coldfusion Database Access, Design and Development.
-
Natesac #1
Query Access Via Date Ranges
Hey, crew... Just trying to figure out the best way to perform queries based on
certain date ranges
Example:
Let's say I want to pull all records that meet this criteria within 0-3months.
Should I create a variable to hold the current date and then do comparisons to
that? I would assume so, but don't know the correct syntax.
If anyone can help, it would be greatly appreciated.
Code Attached:
<cfquery name="getLeads" datasource="momlink">
SELECT Cust.FirstName, Cust.LastName, Cust.Odr_Date, Cust.Orderrec,
Cms.Order_st2
FROM Cust, Cms
WHERE Cust.Orderrec = Cms.Order
AND Cms.Ord_Total gt 0
AND Cms.Ord_Total <= 100
AND Cms.Sales_ID = '#UCase(GetAuthUser())#'
AND **WITHIN DATE RANGE**
</cfquery>
Natesac Guest
-
Verity collection date ranges
I have a collection of documents differentiated by topic and date. The search result looks something like this, "/Supply/Supply2004/23Jan06". I... -
MS Access + date query
Hi I have got access table with two date/time field namely field1 and field2. I made one html form that inputs two dates (it's not mandatory... -
Searching with Date Ranges
If I want to show events (records in a MySQL table) for the next 10 days (and I do), what would be the best approach to searching with this range? ... -
[PHP] Searching with Date Ranges
Seth Willits wrote: SELECT * FROM Table WHERE event_date BETWEEN NOW() AND NOW() + INTERVAL 10 DAY; You quote yourself in your own... -
Date Ranges Reservations Bookings Rentals
Hi Schoffio, There is a great room reservation program created by CobaltSky that he posted on another forum. I have used the exact same... -
Abinidi #2
Re: Query Access Via Date Ranges
Do a lookup on DateDIff. That would allow you to compare dates in SQL.
Abinidi Guest
-
steveInCO #3
Re: Query Access Via Date Ranges
SQL has a between expression. So you could calculate your start and end dates
in CF w/ DateDiff, then use them in the query
SELECT Cust.FirstName, Cust.LastName, Cust.Odr_Date, Cust.Orderrec,
Cms.Order_st2
FROM Cust, Cms
WHERE Cust.Orderrec = Cms.Order
AND Cms.Ord_Total gt 0
AND Cms.Ord_Total <= 100
AND Cms.Sales_ID = '#UCase(GetAuthUser())#'
AND Cust.Odr_Date BETWEEN #calculatedStartDate# and #calculatedEndDate#
steveInCO Guest



Reply With Quote

