Click to See Complete Forum and Search --> : Access to SQL - Help


Bondorofi
12-19-2006, 08:51 AM
I have the following ACCESS CODE I am trying to convert to SQL
ACCESS

SELECT Manage_Pre_Award.A_ID, Manage_Pre_Award.Event_Name, Manage_Pre_Award.Plan_Date, Manage_Pre_Award.Actual_date, Manage_Pre_Award.Rev_Date, IIf([actual_date] Is Not Null,[actual_date],IIf([rev_date] Is Not Null,[rev_date],IIf([plan_date] Is Not Null,[plan_date],Null))) AS workdate, Null AS p_id

FROM Manage_Pre_Award

WHERE (((Manage_Pre_Award.Rev_Date) Is Not Null)) OR (((Manage_Pre_Award.Actual_date) Is Not Null)) OR (((Manage_Pre_Award.Plan_Date) Is Not Null));
--------------------------------------------------------------------------
SQL

SELECT Manage_Pre_Award.A_ID, Manage_Pre_Award.Event_Name, Manage_Pre_Award.Plan_Date, Manage_Pre_Award.Actual_date, Manage_Pre_Award.Rev_Date,
case
when ([actual_date] Is Not Null then [actual_date]
when (([actual_date] Is Null and ([rev_date]) is not Null then ([rev_date])
else ([plan_date])
end
FROM Manage_Pre_Award
WHERE (((Manage_Pre_Award.Rev_Date) Is Not Null)) OR (((Manage_Pre_Award.Actual_date) Is Not Null)) OR (((Manage_Pre_Award.Plan_Date) Is Not Null));

chazzy
12-19-2006, 12:10 PM
Ok. I'm not sure what your question/problem is. If you are getting an error, it would be best to post it.

Bondorofi
12-19-2006, 12:21 PM
Sorry, when I run it, I get this message;
The Query Designer does not support the CASE SQL construct

Nanscombe
12-19-2006, 01:50 PM
Hi Bondorofi,

Since you don't say which flavour of SQL you are using, I've just looked and found the following link which will give you various examples of Conditional constructs.

http://sqlzoo.net/howto/source/z.dir/tip667449/i08fun.xml

I hope there is something that helps amongst that lot.

Regards
Nigel