On Oct 22, 12:05 pm, metaperl <scheme... at (no spam) gmail.com> wrote:
Hello, I have a need to setup a CASE statement in Sybase (Transact)
SQL where one of my branches is like this:
SELECT
CASE WHEN
(SELECT * FROM table WHERE column = 'FY' AND person_id=74) --
----- problem line
THEN 'OK'
ELSE
'BAD'
I think I figured out a way to do it,
perhttp://msdn.microsoft.com/en-us/library/ms181765.aspx
Maybe this will work:
CASE
SELECT COUNT(*) FROM table WHERE column = 'FY' AND person_id=74)
WHEN 0 THEN 'BAD'
ELSE 'OK'
There is not such thing as a CASE statement in SQL; there is a CASE
expression.