title: Mysql select from inner select with join
body: <p>Can I do something like this ? Bassically I user inner select to select lowest date that is bigger than <code>NOW()</code>, for example 9.4.2014 would mathc this, for each event ids. And now I would like to return this, here is the code : </p>
  
  <pre><code>SELECT id_event , event_title, event_details, dates.event_date, id_show, id_category,  distance FROM(
  SELECT event.id_event id_event, event_title, event_details, min(event_date_time) event_date_time, event_showtime.id_show , event_category.id_category id_category, ( 6371 * ACOS( COS( RADIANS(  '49.20513921227407' ) ) * COS( RADIANS( event_showtime.latitude ) ) * COS( RADIANS( event_showtime.longitude ) - RADIANS(  '18.762441839599678' ) ) + SIN( RADIANS(  '49.20513921227407' ) ) * SIN( RADIANS( event_showtime.latitude ) ) ) ) AS distance
  FROM event
  JOIN event_showtime ON event.id_event = event_showtime.id_event
  JOIN event_category ON event.id_category = event_category.id_category
  JOIN (  SELECT id_event, min(event_date_time) as event_date_time FROM event_showtime
  WHERE event_date_time &gt; NOW()
  GROUP BY id_event ) AS dates ON event.id_event = dates.id_event
   WHERE event_date_time &gt; NOW()
  GROUP BY event.id_event
  HAVING distance &lt;  '5'
  ORDER BY distance
  LIMIT 0 , 20
    )t
  </code></pre>
  
  <p>Here is the SQLfiddle <a href="http://www.sqlfiddle.com/#!2/6545ab/51" rel="nofollow">http://www.sqlfiddle.com/#!2/6545ab/51</a> with 3 tables :) <br></p>
  
  <p>How could I access those inner details in the top select ? </p>