小编use*_*724的帖子

在sql server 2005中,如何在一天内完成数量的打孔次数?

CREATE TABLE ALL_PUNCHES_PIVOT2 (ID INT,strcardid NVARCHAR(100),SwipeDate VARCHAR(60),TIME VARCHAR(40));

INSERT INTO ALL_PUNCHES_PIVOT2 (ID,strcardid,SwipeDate,PUNCHTIME)
VALUES (1,'3716817970','01/08/2013','08:47:53')
INSERT INTO ALL_PUNCHES_PIVOT2 (ID,strcardid,SwipeDate,PUNCHTIME)
VALUES (2,'3716817970','01/08/2013','08:47:56')
INSERT INTO ALL_PUNCHES_PIVOT2 (ID,strcardid,SwipeDate,PUNCHTIME)
VALUES (3,'3716817970','01/08/2013','08:52:29')
INSERT INTO ALL_PUNCHES_PIVOT2 (ID,strcardid,SwipeDate,PUNCHTIME)
VALUES (4,'3716817970','01/08/2013','08:52:31')
INSERT INTO ALL_PUNCHES_PIVOT2 (ID,strcardid,SwipeDate,PUNCHTIME)
VALUES (5,'3716817970','01/08/2013','17:50:14')
INSERT INTO ALL_PUNCHES_PIVOT2 (ID,strcardid,SwipeDate,PUNCHTIME)
VALUES (6,'3716817970','01/08/2013','17:50:17')

SELECT * FROM ALL_PUNCHES_PIVOT2;

ID  strcardid   SwipeDate   PunchTime
1   3716817970  01/08/2013  08:47:53
2   3716817970  01/08/2013  08:47:56
3   3716817970  01/08/2013  08:52:29
4   3716817970  01/08/2013  08:52:31
5   3716817970  01/08/2013  17:50:14
6   3716817970  01/08/2013  17:50:17
Run Code Online (Sandbox Code Playgroud)

现在我使用下面的Pivot来获得结果

SELECT * FROM …
Run Code Online (Sandbox Code Playgroud)

sql-server sql-server-2005

5
推荐指数
1
解决办法
77
查看次数

标签 统计

sql-server ×1

sql-server-2005 ×1