title: MySql If Exists Set Value?
body: <p>I have a query that returns a bunch of information and using a join to join two tables and it works perfectly fine.</p>
  
  <p>But I have a field called tickets which I need to see if there is a time available and if there is even one set it to 1 otherwise set it to 0. So like this.</p>
  
  <pre><code>SELECT 
  name,poster,sid,tickets = (IF SELECT id FROM times WHERE shows.tid=times.tid LIMIT 1, 
  if value returned set to 1, otherwise set to 0) 
  FROM shows JOIN show_info ON (id) WHERE sid=54 order by name ASC
  </code></pre>
  
  <p>Obviously that is not a correct MySQL statement, but it would give an example of what I am looking for.</p>
  
  <p>Is this possible? Or do I need to do the first select then for a loop through results and do the second select and set value that way? Or is one better performance wise?</p>