Java代碼
SELECT count(DISTINCT(a
DATE_FORMAT(submit_date
FROM
表名 a
WHERE
a
AND a
AND a
GROUP BY
a
DATE_FORMAT(submit_date
其中關鍵在於DATE_FORMAT(submit_date
Java代碼
SELECT
zsubmit_date
MAX(CASE WHEN job_dept =
MAX(CASE WHEN job_dept =
MAX(CASE WHEN job_dept =
FROM
(
SELECT
count(DISTINCT(a
DATE_FORMAT(submit_date
FROM
表名 a
WHERE
a
AND a
AND a
GROUP BY
a
DATE_FORMAT(submit_date
) q
GROUP BY
zsubmit_date
以上是mysql的列轉行
From:http://tw.wingwit.com/Article/program/MySQL/201311/11208.html