我的列名为
TimeStart Scanner
我希望使用数据透视操作跟随输出。请帮助我实现以下目标。
TimeStart Hour Scanner1 Scanner2 Scanner3 Scanner4 Total
00:00 1 8000 9425 7200 8400 33026
01:00 2 11000 10800 7700 8100 37602
02:00 3 6850 11450 7940 7900 34143
03:00 4 7200 600 9425 7700 24929
04:00 5 7900 0 10800 8650 27355
05:00 6 8120 0 11450 8800 28376
06:00 7 8450 0 10800 9275 28532
07:00 8 7850 0 10700 9285 27843
08:00 9 9690 0 9500 8400 27599
09:00 10 10400 0 8100 8150 26660
10:00 11 9420 0 7740 7740 24911
11:00 12 9850 0 7650 7650 25162
12:00 13 7475 1500 6500 6500 21988
13:00 14 8400 4800 9750 9750 32714
14:00 15 8200 9850 7740 8800 34605
15:00 16 9425 9500 7650 8750 35341
16:00 17 10800 8100 6500 9425 34842
17:00 18 11450 7740 9750 10800 39758
18:00 19 10800 6984 8700 11450 37953
19:00 20 10700 7420 7740 10800 36680
20:00 21 9500 6000 7650 10700 33871
21:00 22 8100 4800 6500 9500 28922
22:00 23 7740 4200 9750 8100 29813
23:00 24 7650 600 11450 7740 27464
答案 0 :(得分:1)
您也可以使用<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Admin Panel</title>
</head>
<body>
<%
UserService us = ServiceProvider.getUserService();
List<User> allUsers = us.getAllUsers();
request.setAttribute("allUsers", allUsers);
%>
<h1>This is the admin panel</h1>
<c:forEach step="1" var="user" items="${allUsers}">
<h3>${user.firstName} ${user.lastName}</h3>
<c:out value="${user.allPomodoros}" /> // shows up empty
<c:forEach step="1" var="pomodoro" items="${user.allPomodoros}">
<table>
<tr>
<th>User ID</th>
<th>Start Time</th>
<th>End Time</th>
<th>Completed</th>
<th>Pomodoro ID</th>
</tr>
<tr>
<td>${pomodoro.userID}</td>
<td>${pomodoro.beginTime}</td>
<td>${pomodoro.endTime}</td>
<td>${pomodoro.isCompleted}</td>
<td>${pomodoro.pomodoroID}</td>
</tr>
</table>
</c:forEach>
</c:forEach>
</body>
</html>
和CASE EXPRESSION
ROW_NUMBER()