Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query-problem

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2010-01-19 : 06:40:08
how can i get the last update rows,i have this table(for example):

OrderDate OrderNo Mins MaxS

19-01-2010 15:50:30.540 123 6 7
19-01-2010 15:50:30.540 123 7 7

i want the the rows where i have the mins and maxs have maximun

OrderDate OrderNo Mins MaxS
19-01-2010 15:50:30.540 123 7 7

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-19 : 06:59:46
SELECT OrderDate, OrderNo, MAX(MinS), MAX(MaxS)
FROM Table1
GROUP BY OrderDate, OrderNo



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-19 : 07:00:41
Shouldn't it be minimum of MinS och maximum of MaxS?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -