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

Date Value

Status
Not open for further replies.

boatguy

Programmer
Oct 22, 2001
153
US
I have a view that has a date field named DateLastLeadSent. The function that I am trying to accieve via ColdFusion is to email a lead to a sales rep who has waited the longest to receive a new lead. I am just not sure how to say where the time between NOW and DateLastLeadSent is the greatest. Any suggestions? Need more information?
 
With SQL Server, you use GetDate() to return the current date and time of the sql server.

There is also a DateDiff function that will calculate intervals for you, so...

Select DateDiff(Minute, '2005-12-27 7:30', GetDate())

will return the number of minutes that have elapsed since 7:30



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
> I am just not sure how to say where the time between NOW and DateLastLeadSent is the greatest

What about SELECT TOP 1 and ORDER BY DateLastLeadSent?

> Need more information?

Probably :)

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Hmmmm. I am passing a variable to the CF query that pulls only specific product so that the lead is not only passed to the rep who's waited the longest, but also that the rep is "certified" to receive a lead for the specific product. Having said that, TOP 1 will not work, but I supposed I could order the view by DateLastLeadSent and put maxrows=1 in my CF query. Thanks to all of you. You've given me enough info to get me started on a solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top