SELECT
`name`,
MAX(
CASE
WHEN course='语文' THEN
score
END
) AS 语文,
MAX(
CASE
WHEN course='数学' THEN
score
END
) AS 数学,
MAX(
CASE
WHEN course='英语' THEN
score
END
) AS 英语
FROM
student
GROUP BY `name`
;
SELECT DISTINCT EMP_NO,MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'01',CARD_FREQUENCY)) D01,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'02',CARD_FREQUENCY)) D02,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'03',CARD_FREQUENCY)) D03,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'04',CARD_FREQUENCY)) D04,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'05',CARD_FREQUENCY)) D05,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'06',CARD_FREQUENCY)) D06,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'07',CARD_FREQUENCY)) D07,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'08',CARD_FREQUENCY)) D08,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'09',CARD_FREQUENCY)) D09,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'10',CARD_FREQUENCY)) D10,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'11',CARD_FREQUENCY)) D11,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'12',CARD_FREQUENCY)) D12,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'13',CARD_FREQUENCY)) D13,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'14',CARD_FREQUENCY)) D14,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'15',CARD_FREQUENCY)) D15,
MAX(DECODE(TO_CHAR(WORK_DATE,'DD'),'16',CARD_FREQUENCY)) D16
FROM HRA_READ_CARD_MONTH
WHERE EMP_NO='090641' AND TO_CHAR(WORK_DATE,'YYYY/MM')='2009/03'
GROUP BY EMP_NO