Shabar
Shabar

Reputation: 2821

IIF column comparison in Sybase

How do we do following column comparison in Sybase (isql)

SELECT.....
FROM
WHERE IIF(Col1 = "4", "00", Col1)  = Mid (Col4,1,2)

I tried below, but didn't succeed

SELECT ...
FROM
WHERE
(case
      when Col1 = "4" then "00"
      else Col1
end)  = Mid (Col4,1,2)

Thanks

Upvotes: 0

Views: 3663

Answers (1)

Robert
Robert

Reputation: 25753

You have to use substring function instead of Mid.

SELECT ...
FROM
WHERE
(case
      when Col1 = "4" then "00"
      else Col1
end)  = substring(Col4,1,2)

Upvotes: 1

Related Questions