John Nelson over at myITforum has a excellent blog covering SMS.
You'll find a treasure trove of superb SQL queries that accomplish specific tasks as well as give you an insight in to how best to do things in SQL. Great resource for budding SQL\SMS guru's :-)
Johns treasure horde of SMS knowledge
Read the complete post at http://wmug.co.uk/blogs/r0b/archive/2010/01/04/johns-amazing-stash.aspx