title: How get records by last date with specific query
body: <p>I have table currencies and table this courses data . How i can get  one course data for each currency by last date
  This is my code where i get courses for each currency by  date:</p>
  
  <pre><code>SELECT
      `coll_currency`.`collectionAlias`,
      `coll_currency`.`currency_abbr`,
      `coll_currency`.`currency_image`,
      `coll_currency`.`currency_name`,
      `coll_currency`.`currency_amount`,
      `coll_currency`.`id`,
      `pars_table`.`course` AS `currency_course`,
      `pars_table`.`publishdate` AS `currency_publishdate`,
      `pars_table`.`currency_id`
  FROM
      `coll_currency`
  INNER JOIN `pars_currency_nbu` AS `pars_table` 
     ON coll_currency.id = pars_table.currency_id
  WHERE
      (
          (`currency_type` = '3670924')
          AND (`currency_state` = '3583429')
          AND (
              DATE_FORMAT(
                  `pars_table`.`publishdate`,
                  '%Y-%m-%d'
              ) = '2017-08-09'
          )
      )
  ORDER BY
      `currency_publishdate` DESC
  </code></pre>