Q:

SQL command to find when a document was last printed? 

I have a table of document names and dates when they were printed.  Say:
aaa    2006-09-15
aaa    2007-09-15
abc    2013-08-12
abc    2012-08-12

After the command executes I need:
aaa 2007-09-15
abc 2013-08-12

I got something close to a correct output but it involved temporary tables.  I'm trying to put this into Microsoft BIDS and it doesn't like me using #temp_table. 
Ideas? 

A:

Try this:
SELECT doc_name, max(date_printed) FROM your_table GROUP BY doc_name;

Here's the fiddle so you can check http://sqlfiddle.com/#!2/dd156/3

