title: using select statement in then clause of case
body: <p>I'm trying to include select statement in the <code>then</code> of <code>case</code> statement but the output is not as expected. I know there is different method to do this but can it be done the way i'm trying to do.</p>
  
  <p>Using the following example data:</p>
  
  <pre><code>create table example(name varchar(10));
  
  insert into example values
  ('abc'),('bcd'),('xyz');
  </code></pre>
  
  <p>I have tried this query (here is the <a href="http://www.sqlfiddle.com/#!2/366db9/6" rel="nofollow">fiddle</a>):</p>
  
  <pre><code>select 
  case when ((select * from example where name='abc')&gt;=1)
  then (select * from example where name='abc')
  else (select count(*) from example)
  end
  from example
  </code></pre>
  
  <p>But it outputs</p>
  
  <pre>
  3
  3
  3
  </pre>
  
  <p>Expected output if <code>name='abc'</code> exist</p>
  
  <pre><code>name
  abc
  </code></pre>
  
  <p>if not the <code>count(*)</code></p>
  
  <p>Thanks in advance</p>