title: MySQL error code needed
body: <p>MySQL always sends a "default response" even when the data doesn't match the query!</p>
  
  <p>How can I design my query to get an error code from MySQL if no data is matching the query?</p>
  
  <p>I need an error code from MySQL to create a 404 or 410 page.</p>
  
  <pre><code>SELECT
  place.ID AS id,
  place.latitude AS lat,
  place.longitude AS lng,
  
  IF(
  place.translationID IS NULL,
  place.name,
  placel10n.text
  ) AS cityname,
  
  IF(
  admcode.translationID IS NULL,
  '',
  statel10n.text
  ) AS statename,
  
  IF (  
  countrycode.translationID IS NULL,
  countrycode.name,
  countryl10n.Text
  ) AS countryname,
  
  IF(
  place.textID IS NULL,
  '',
  `l10n-strings`.text
  ) AS description
  
  FROM
  places AS place
  
  LEFT JOIN `l10n-strings` AS placel10n ON (place.translationID = placel10n.translationID         AND placel10n.languageCode = 'de')
  LEFT JOIN admin1codesascii AS admcode ON (place.admin1 = admcode.statecode AND     place.country = admcode.country)
  LEFT JOIN `l10n-strings` AS statel10n ON (admcode.translationID =    statel10n.translationID AND statel10n.languageCode = 'de')
  LEFT JOIN countries AS countrycode ON (place.country = countrycode.iso_alpha2)
  LEFT JOIN `l10n-strings` AS countryl10n ON (countrycode.translationID =    countryl10n.TranslationID AND countryl10n.LanguageCode = 'de')
  
  LEFT JOIN texts ON (place.textID = texts.id)
  LEFT JOIN `l10n-strings` ON (texts.translationID = `l10n-strings`.translationID AND    `l10n-strings`.languageCode= 'de')
  
  WHERE
  place.id = '8'
  AND
  place.featurecode = 'A'
  OR
  place.featurecode = 'AB'
  OR
  place.featurecode = 'AAC'
  
  LIMIT 0,1
  </code></pre>
  
  <p>This query always returns a result even when the <code>where</code> statements are wrong.</p>