top 1 case in select statement on TSQL

I am having problem on this query. How can I fix this:

select (select case top 1 STATUS 
       when 'Inprocess' then 'Processing' 
       when 'Inworkbin' then 'Waiting In Draft' 
       end 
    from ICS_EMAIL_CONNECTIONS_TRX A    
    where A.SESSIONID = B.SESSIONID 
    and STATUS <> 'Completed'
    order by A.CREATE_DATE desc) as LAST_STATUS 

I am getting this error:

Incorrect syntax near the keyword 'top'.

Any suggestions?

Answers


Try:

select top 1 case STATUS

instead of

select case top 1 STATUS 

Need Your Help

Masking floating point cv::Mat without looping

c++ opencv

At a point in my code I have a cv::Mat with the type CV_8U and a cv::Mat with the type CV_64f. I want to know if there is a clever way to masking the floating point image with the char image without

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.