title: Exclude records from query based on table join results
body: <p>I have two tables.</p>
  
  <p>Videos;
  ID,
  Artist,
  Title</p>
  
  <p>runlog;
  VideoID,    'joins to videos.ID
  datetime</p>
  
  <p>I'd like to run a query on the Videos table excluding records on three conditions. (as examples. I have multiple conditions, but if I get some help on these, I can probably figure everything else out.</p>
  
  <ul>
  <li>Any video that shows up in Runlog in the past hour will not show up in the results</li>
  <li>Any Artist that has had a video show up in the runlog in the past hour will not have any other records by the same Artist show up at all in the query</li>
  <li>Any Artist that has had a video show up in the runlog three times in the past 24 hours will not have any other records by the same Artist show up at all in the query</li>
  </ul>
  
  <p>This gets me the first result requirement but I feel it could be written better.</p>
  
  <pre><code>    SELECT ID,Artist, Title FROM
      videos join runlog on runlog.videoID = videos.id
      where 
      (select COUNT(*) from runlog where datetime &gt; DATEADD(hh,-12,GETDATE())
      and runlog.videoID = videos.id) = 0 
      order by Artist, Title
  </code></pre>
  
  <p>The second requirement I can't figure out how to put together in the same query.</p>