title: SQL Get max date in dataset for each month
body: <p>I have a table with INT id and DATETIME date, amongst other fields.  Rows are inserted into this table each weekday (not guaranteed), and several other tables use this id as a foreign key.</p>
  
  <p>My question is, how can I get the id for the max date of each month, which I can then use to join to other data tables?  For example, if the process ran today, I would want to see data for Jan 31, Feb 28, ... , Oct 31, Nov 23.</p>
  
  <p>I am using SQL Server 2005.</p>