|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
A problem with "where" clause
I'm new in Access. Please help me with following problem.
I try to query my DB from my ASP code with the code below, but it doesn't work: Set RS=conn.execute ("Select * from mytable1 where DateAdd('m',Interval,StartDate)>=#01/01/2004#") "Interval" and "StartDate" are two fields in mytable1. "Interval" is "Number(Integer)" data type, "StartDate" is "Date/Time(Short Date)". If I replace "Interval" with one specific number, i.e."9", the query is executed without any problem. How can I make the query work? Please help me. Thank you. |
|
#2
|
||||
|
||||
|
Try something like this:
Select * from mytable1 where DateAdd('m',Month(Interval),StartDate)>=#01/01/2004#") no promises though! =) I do know that the second parameter of a DateAdd function is expected to be a number... |
|
#3
|
||||
|
||||
|
Well - I'm not sure how exactly the SQL engine would know which record to get, to use as the value for Interval, because it needs that Interval value to evaluate the WHERE statement. This looks like a logic issue, rather than syntax.
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > A problem with "where" clause |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|