求某字段最大值的一条记录的集合,该如何解决

求某字段最大值的一条记录的集合
create table testsql (name varchar(10),hours varchar(4),date varchar(8));
insert into testsql ('张三','8','20080101');
insert into testsql ('张三','10','20080102');
insert into testsql ('张三','9','20080103');
insert into testsql ('张三','7','20080104');
insert into testsql ('李四','7','20080104');
insert into testsql ('李四','1','20080105');
insert into testsql ('李四','2','20080106');
insert into testsql ('李四','3','20080107');

表定义:
TESTSQL表中记录每个员工每天工作的小时数

功能实现:
取出TESTSQL表中每个员工某天工作量最大的一条记录信息,结果期望如下
'张三','10','20080102'
'李四','7','20080104'

不能使用存储过程

------解决方案--------------------
--首先SQL有问题,帮你改下(values)。
create table testsql (name varchar(10),hours varchar(4),date varchar(8));
insert into testsql values('张三','8','20080101');
insert into testsql values('张三','10','20080102');
insert into testsql values('张三','9','20080103');
insert into testsql values('张三','7','20080104');
insert into testsql values('李四','7','20080104');
insert into testsql values('李四','1','20080105');
insert into testsql values('李四','2','20080106');
insert into testsql values('李四','3','20080107');
--建议hours改为数字型好比较大小
--sql
Select t2.* from
 (select name,char(max(int(hours))) as hours from testsql group by name) as t1,
 testsql t2
 where t1.name=t2.name
 and t1.hours=t2.hours

------解决方案--------------------
不明LZ在说什么
------解决方案--------------------
引用楼主 walkwolf 的帖子:
create table testsql (name varchar(10),hours varchar(4),date varchar(8));
insert into testsql ('张三','8','20080101');
insert into testsql ('张三','10','20080102');
insert into testsql ('张三','9','20080103');
insert into testsql ('张三','7','20080104');
insert into testsql ('李四','7','20080104');
insert into testsql ('李四','1','20080105');
insert into testsql ('李四','2','200801…
表定义:
TESTSQL表中记录每个员工每天工作的小时数

功能实现:
取出TESTSQL表中每个员工某天工作量最大的一条记录信息,结果期望如下
'张三','10','20080102'
'李四','7','20080104'

不能使用存储过程