Writing the SQL Query in SQL Server 2005's Management Studio