How To Write Query In Sql Server 2008