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.
| Author |
Topic |
|
sqldba2k6
Posting Yak Master
176 Posts |
Posted - 2007-04-09 : 13:51:14
|
| I need a query help in getting the results:EmpNo Empdate----- ---------- 01 06/23/200601 06/28/200602 03/24/200603 05/21/200603 06/24/200604 09/27/2006Output:EmpNo Empdate----- ---------- 01 06/28/200602 03/24/200603 06/24/200604 09/27/2006 |
|
|
spejbl
Starting Member
28 Posts |
|
|
sqldba2k6
Posting Yak Master
176 Posts |
Posted - 2007-04-09 : 14:46:50
|
| Thanks !!Incase of having nulls in the table how to rewrite the queryEmpNo Empdate----- ---------- 01 Null01 06/28/200602 03/24/200603 Null03 06/24/200604 09/27/2006Output:EmpNo Empdate----- ---------- 01 06/28/200602 03/24/200603 06/24/200604 09/27/2006 |
 |
|
|
spejbl
Starting Member
28 Posts |
Posted - 2007-04-09 : 14:51:44
|
| [code]SELECT EmpNo, MAX(Empdate)FROM dbo.YourTableWHERE Empdate IS NOT NULLGROUP BY EmpNoORDER BY EmpNo[/code]--TomMicrosoft KB articles monitoring |
 |
|
|
|
|
|