在pivot中没有显示特定条件

时间:2016-03-11 11:34:27

标签: sql oracle11g

我想知道,如下面的代码所示,是否可以放入*而不是在“for attendance_day IN('23 -oct-16','24 -oct-16')”中指定日期“ null,要显示的特定值

select *  
from 
(
   select STUDENT.id, student_name, attendance_day, attendance_type_id
   from attendance RIGHT JOIN student ON (ATTENDANCE.STUDENT_ID = STUDENT.ID)
) src

pivot
(
  sum(attendance_type_id)
  for attendance_day IN ('23-oct-16', '24-oct-16')
) piv;

这是我的出勤表和学生表

Create Table attendance
(
   student_id number (4),
   attendance_day date,
   attendance_type_id varchar2 (10)
);

Create Table student
(
   student_id number (4),
   student_name varchar2 (20),
   nationality varchar2 (10)
);

0 个答案:

没有答案