I am using SQL Server 2008.
I have the following query.
What I like to do is if when there is a record that EXIST, I like to assign Actual Date to ‘N/A’
else I like to have it be the CreatedBy date that is in Hand.
select ActualDate = (CASE
WHEN EXISTS
(select NeedHand from Truck
where Truck.NeedHand = 0 and Truck.ID = '34343')
THEN
'N/A'
ELSE
SELECT CreatedByDate from Hand where ID = '34343'
END )
I get the following message:
Incorrect syntax near the keyword ‘select’.
There are a number of problems with your query. The version below should take care of all of them:
I had to :
EXISTtoEXISTSEND CASEtoEND