title: Syntax Error in CASE STATEMENT
body: <p>Here is my select statement.  What I'm trying to do is if an account has more than one ID, I want the phone number to be NULL, ELSE I want the phone number to = phone_number_formatted:</p>
  
  <pre><code>SELECT
      v_returned_inventory.order_id,
      v_live_inventory.inet_event_description,
      v_live_inventory.event_time,
      v_cust_phone.phone_number_formatted,
      v_live_inventory.event_date,
      v_returned_inventory.section_name,
      v_returned_inventory.add_usr,
      v_live_inventory.num_seats,
      v_returned_inventory.acct_id,
      v_live_inventory.class_name,
      AT_trans_for_emailTrigger.email_addr,
      AT_trans_for_emailTrigger.cust_name_id,
      premclub.name_first + ' ' + premclub.name_last AS name      
  FROM
      v_returned_inventory 
  INNER JOIN
      v_live_inventory 
          ON 
  LEFT(v_returned_inventory.event_name, 6) = LEFT(v_live_inventory.event_name, 6) 
  AND                             v_returned_inventory.orderNumber = v_live_inventory.other_info_1 INNER JOIN
      AT_trans_for_emailTrigger 
          ON v_returned_inventory.order_id = AT_trans_for_emailTrigger.order_id 
  LEFT OUTER JOIN
      v_cust_phone 
          on v_cust_phone.acct_id = v_returned_inventory.acct_id 
  LEFT OUTER JOIN
      OPENQUERY(premclub, 'select name_first, name_last, cust_name_id from dba.v_cust_name') AS premclub 
          ON                             AT_trans_for_emailTrigger.cust_name_id = premclub.cust_name_id,
      **CASE 
          WHEN (select
              count(cust_name_id) 
          from
              v_cust_phone) &gt; 1 then null 
          else v_cust_phone.phone_number_formatted 
      END**
  </code></pre>