I want to write an if statement testing two conditions.
In particular I want to say:
if date 1%26lt;DATE OR date 2%26lt;DATE
then field 4 = xx
else field 4 = yy
How can I write that in access (SQL)?
Thanks.|||Access doesn't use the CASE stucture, but there are a couple of alternatives, SWITCH or IIF. The latter is probably appropriate for your situation.
field4 = IIF(date1 %26lt; DATE OR date2 %26lt; DATE, xx, yy)|||You can use CASE expression in SQL:
Select case when (date 1%26lt;DATE OR date 2%26lt;DATE) then 'xx' else 'yy' end as [4]
from MyTable
In Access you can use IIF function.
IIF((date 1%26lt;DATE OR date 2%26lt;DATE),'xx','yy')|||I think it's translated into two update statements
it should look like
Update TableName
Set field4 = xx
where (date1%26lt; DATE) OR (date2 %26lt; DATE)
Update TableName
Set field4 = yy
where (date1%26gt;= DATE) AND (date2 %26gt;= DATE)|||its
-----------
if
else if
else
----------------
try that, it works for me in javascript...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment