sql server - SQL Order By and "Not-So-Much Group" -


Let's say I have a table: ---------------- --- ------------------- | ID | DATE | Group | Results | -------------------------------------- | 1 | 01/06 | Group 1 | 12345 | | 2 | 01/05 | Group 2 | 54321 | | 3 | 01/04 || Group 1 | 11111 | --------------------------------------

I want to order As a result of the most recent date at the top, but the group "group" column together, but still have specific entries. As a result, I want to:

  1 | 01/06 | Group 1 | 12345 3 | 01/04 || Group 1 | 11111 2 01/05 | Group 2 |  

Edit:

I am using MSSSQL. I will try to translate the Oracle query into MS SQL and report my results.

Edit

SQL Server 2000, therefore the over / partitions are not supported [

 Table table (ID int null, [DATE] Small data type, [group] varchar (10) not tap, [RESULT] varchar (10) Empty) Insert @table value (1, '2009-01-06', 'Group 1', '12345') @table value (2, '2009-01-05', 'Group 2', '12345' ) Insert @table values ​​(3, '2009-01-04', 'group 1', '12345'). T [x] [x] [x] [x] [x] [x] [x] command [x] -date] desc, t. [Group], T. [DATE] desc  

Comments

Popular posts from this blog

MySql variables and php -

c# - How can I find out if there are windows above a control? -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -