Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max

Status
Not open for further replies.

jrprogr

Programmer
Joined
Jul 20, 2006
Messages
74
Location
US
I need help in getting the results:

EmpNo Empdate
----- ----------
01 06/23/2006
01 06/28/2006
02 03/24/2006
03 05/21/2006
03 06/24/2006
04 09/27/2006

Output:

EmpNo Empdate
----- ----------
01 06/28/2006
02 03/24/2006
03 06/24/2006
04 09/27/2006


 
Code:
[COLOR=blue]SELECT[/color] EmpNo, [COLOR=#FF00FF]MAX[/color](Empdate) [COLOR=blue]AS[/color] Empdate
       [COLOR=blue]FROM[/color] YourTable
[COLOR=blue]GROUP[/color] [COLOR=blue]BY[/color] EmpNo

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Thanks !!
Incase of having nulls in the table

EmpNo Empdate
----- ----------
01 Null
01 06/28/2006
02 03/24/2006
03 Null
03 06/24/2006
04 09/27/2006

Output:

EmpNo Empdate
----- ----------
01 06/28/2006
02 03/24/2006
03 06/24/2006
04 09/27/2006
 
The same

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top