title: SQL server apply Month or year condition
body: <p>I have a table in SQL server, I have a column in it with datatype DateTime, I want to get data on specific month or year, ie</p>
  
  <pre><code>Select * from Table where datejoined='07'//Getting July Data
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Select * from Table where datejoined='2013'//Getting 2013 Data
  </code></pre>
  
  <p>I have tried this,but its comparing the minutes of time</p>
  
  <pre><code>select * from Table where datejoined like '%07%'
  </code></pre>