title: mysql join with condition
body: <p>I have two table with this structure</p>
  
  <pre><code>categories
  --------------------------------
  id  | create
  1   | 2012-12-01 12:00:00
  2   | 2012-12-01 12:00:00
  
  category_i18ns
  --------------------------------
  category_id     | lang  | title
  1               | en    | home page
  1               | de    | HomE PAGEa
  1               | fa    | خانه
  2               | en    | about
  </code></pre>
  
  <p>some categories have all languages data and some another havnt. for example category id 2 just have <code>en</code> translated title. i want to have a query that first check the current language for retrieve title and then if not exist then show another ones.</p>
  
  <p>i have a query to get current category data with i18n data
  in this current example <code>de</code> is default language. for category id <code>1</code> we have <code>de</code> title but for category <code>2</code> we dont. so i want english version as title of category</p>
  
  <pre><code>SELECT * FROM `mhf_swe_ndzhmju3_test`.`categories` AS `Category`
  LEFT JOIN `mhf_swe_ndzhmju3_test`.`category_i18ns` AS `CategoryLocale` ON (
  `CategoryLocale`.`category_id` = `Category`.`id`
  AND `CategoryLocale`.`lang` = 'de')
  </code></pre>
  
  <p>desire out put for 'de' language</p>
  
  <pre><code>Category.id     CategoryLocale.title    CategoryLocale.lang
  1               HomE PAGEa              de
  2               about                   en
  </code></pre>