我已经从谷歌图表中绘制图表了。这是图表
这是我的sql
$sql = 'SELECT ljj.job_id, SUM(CASE WHEN ljj.job_type = "0" THEN 1 ELSE 0 END) AS jobcount, SUM(CASE WHEN ljj.job_type = "1" THEN 1 ELSE 0 END) AS interncount, MONTH(FROM_UNIXTIME(ljj.job_timepublished)) AS month FROM {local_jobs_job} ljj INNER JOIN {local_jobs_location} ljl ON ljj.job_location = ljl.location_id INNER JOIN {local_companydetail} lc ON ljj.job_company_userid = lc.userid WHERE lc.link = "1" GROUP BY MONTH(FROM_UNIXTIME(ljj.job_timepublished))';
如何将数字中的月份转换为Jan,March,July等名称?
答案 0 :(得分:1)
您可以使用monthname
功能代替month
:
SELECT ljj.job_id,
SUM(CASE WHEN ljj.job_type = "0" THEN 1 ELSE 0 END) AS jobcount,
SUM(CASE WHEN ljj.job_type = "1" THEN 1 ELSE 0 END) AS interncount,
MONTHNAME(FROM_UNIXTIME(ljj.job_timepublished)) AS "month" -- Here!
FROM {local_jobs_job} ljj
INNER JOIN {local_jobs_location} ljl ON ljj.job_location = ljl.location_id
INNER JOIN {local_companydetail} lc ON ljj.job_company_userid = lc.userid
WHERE lc.link = "1"
GROUP BY MONTHNAME(FROM_UNIXTIME(ljj.job_timepublished)) -- And here!