#2
阳光上的桥2023-03-27 16:57
|
程序代码:
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')
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最后一次的信息,如何写呢?WINDOWS XP系统,SQL SERVER 2000数据库