title: sql list actors who acted in a film before 1900 and also in a film after 2000
body: <p>so I have 3 tables, actor(id, name), movie (id,name,year) and casts(aid, mid) (which are actor id and movie id). My goal is to select all the actors who acted in a film before 1900 and also in a film after 2000.
  My query is </p>
  
  <pre><code>select a.id 
  from actor a, movie m1, casts c1, movie m2, casts c2
  where a.id = c1.aid = c2.aid and c1.mid = m1.id and c2.mid = m2.id and
  m1.year &gt;2000 and m2.year &lt;1900;
  </code></pre>
  
  <p>this query took really long time and didnt seem to produce the right result.
  So someone could please help me?</p>