程序代码:
create TABLE a(userid CHAR(6),pcharge numeric(9,2),createtime datetime)
INSERT INTO A VALUES('000001',10.21,'2001-01-01 12:00')
INSERT INTO A VALUES('000001',10.21,'2001-06-15 08:01')
INSERT INTO A VALUES('000002',10.21,'2011-07-17 05:00')
INSERT INTO A VALUES('000003',10.21,'2021-01-27 03:00')
INSERT INTO A VALUES('000001',10.21,'2002-03-13 02:00')
INSERT INTO A VALUES('000004',10.21,'2008-05-05 16:00')
INSERT INTO A VALUES('000005',10.21,'2009-03-04 17:00')
INSERT INTO A VALUES('000066',10.21,'2017-05-08 14:00')
INSERT INTO A VALUES('000003',10.21,'2023-09-03 13:00')
INSERT INTO A VALUES('000002',10.21,'2020-08-06 18:00')
INSERT INTO A VALUES('000001',10.21,'2001-06-15 08:02')
INSERT INTO A VALUES('000002',10.21,'2000-05-09 04:00')
INSERT INTO A VALUES('000001',10.21,'2002-03-06 17:00')
我想查询这个表的每个userid的最后一次记录,如何写呢?winXP+sql 2000