|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Dateadd
Can any help me? I have a problem with this DATEADD function, its supposed to pull out entries for the next week. Can anyone spot what I'm doing wrong
![]() " WHERE (tblContactLog.CallBackEmployee_id = " & Session("UserID") & ")" & _ " AND (tblContactLog.ContactLog_Complete <> 1)" & _ " AND (tblContactLog.ContactLog_CallBackDate < DATEADD(ww, 1, ContactLog_CallBackDate))" & _
__________________
"When I read about the evils of drinking, I gave up reading."
|
|
#2
|
||||
|
||||
|
two things
first, you end with a concatenation (is there more to this query?) second, you are testing ... AND (X < DATEADD(ww, 1, X)) which will find any date that is less than a week after itself??? i.e. none |
|
#3
|
||||
|
||||
|
Thanks for your help. Heres the full code, all I want to do is pull out entries for the next week for that user. Its basically a contact log. Any ideas!
set rs = objConn.execute("SELECT tblContactLog.*, tblContactLogType.ContactLogType_desc, " & _ " tblLeads.name, tblLeads.surname, tblLeads.lead_id, tblInternalEmployees.fullname" & _ " FROM tblContactLog" & _ " INNER JOIN tblContactLogType ON tblContactLog.ContactLogType_id = tblContactLogType.ContactLogType_id" & _ " INNER JOIN tblLeads ON tblContactLog.lead_id = tblLeads.lead_id" & _ " INNER JOIN tblInternalEmployees ON tblContactLog.InternalEmployee_id = tblInternalEmployees.user_id" & _ " WHERE (tblContactLog.CallBackEmployee_id = " & Session("UserID") & ")" & _ " AND (tblContactLog.ContactLog_Complete <> 1)" & _ " AND (tblContactLog.ContactLog_CallBackDate < DATEADD(ww, 1, ContactLog_CallBackDate))" & _ " ORDER BY " & _ " CASE " & _ " WHEN tblContactLog.ContactLog_Priority=1 THEN 0 " & _ " ELSE 1 " & _ " END, tblContactLog.ContactLog_CallBackDate ASC") |
|
#4
|
||||
|
||||
|
you are still doing the impossible:
Code:
AND (tblContactLog.ContactLog_CallBackDate < DATEADD(ww, 1, ContactLog_CallBackDate)) you might try Code:
AND (tblContactLog.ContactLog_CallBackDate < DATEADD(ww, 1, getdate())) |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Dateadd |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|