title: Select data the the ID exists on another table in SQL
body: <p>I have 2 tables, let says the first table named "Schedule" and the second named "Setting".</p>
  
  <p>TABLE "SCHEDULE"</p>
  
  <pre><code> ID    Name    StartTime    EndTime     Room  
  ---------------------------------------------
   111   AAAA    08:00        09:00       -
   112   BBBB    08:00        09:00       -
   113   CCCC    08:00        09:00       -
   114   DDDD    08:30        09:30       -
   115   EEEE    08:30        09:30       -   
   116   FFFF    08:30        09:30       -      
  </code></pre>
  
  <p>TABLE "SETTING"</p>
  
  <pre><code> ID    Type    Room  
  ------------------------
   111     1     BPD01  
   112     2     BPR33  
   113     2     BPR33  
   114     2     BPR35  
   115     2     BPR33  
  </code></pre>
  
  <p>I want to get the result like:</p>
  
  <pre><code> Room    StartTime  EndTime  Total Used   
  ---------------------------------------
   BPR33   08:00      09:00    2           
   BPR33   08:30      09:30    1           
   BPR35   08:30      09:30    1               
  </code></pre>
  
  <p>I have the code like:</p>
  
  <pre><code>SELECT ST.Room, S.StartTime, S.EndTime, COUNT(*) AS [Total Used]
  FROM Schedule AS S CROSS JOIN Setting AS ST
  WHERE (ID IN
    (SELECT ID FROM Setting
     WHERE (Type = '2')))
  GROUP BY ST.Room, S.StartTime, S.EndTime
  </code></pre>
  
  <p>But the code resulted in showing all of the record in Setting with the counted value, the filter does not run properly.</p>
  
  <p>How to do that?</p>