title: adding another where condition on inner join query
body: <p>i got an issue with selecting data from below query based on mtb.mid .
  all i want is to select below query base on highest mtb.mid but i cant figure it out where do i need to put that cause on my where clause or other place ....</p>
  
  <p>here is my fine and working query that give me result that i need to add a filter that i talked above .</p>
  
  <pre><code>SELECT DISTINCT TOP (100) PERCENT wTB.Week, wTB.Description, wTB.wid, mTB.mid
  FROM           yTB INNER JOIN
                           mTB ON yTB.yid = mTB.yid INNER JOIN
                           wTB ON mTB.mid = wTB.mid INNER JOIN
                           dTB ON wTB.wid = dTB.wid
  WHERE        (dTB.dateEn &lt;= CAST(GETDATE() AS DATE))
  ORDER BY wTB.Week
  </code></pre>
  
  <p>Thanks in advance.</p>