到目前为止,我的代码如下:我试图找出用什么来代替我的 ? 以找到日期所在季度的开始日期。
SELECT
QUARTER(r.callDate) AS quar,
YEAR(r.callDate) AS ryear,
???????? AS scoreDateStart,
(SELECT DATE (DATE_SUB( DATE_ADD( CONCAT( YEAR( r.callDate ), '-01-01'), INTERVAL QUARTER(r.callDate) QUARTER ), INTERVAL 1 DAY))) AS scoreDateEnd,
group_concat(DISTINCT(r.resultId) separator ', ') AS resultIds
FROM results AS r
GROUP BY quar, ryear
ORDER BY quar;
我试过谷歌搜索但无济于事。
输出的一个例子是:
'1', '2012', '2012-01-01', '2012-03-31', '57, 58, 59'
'2', '2012', '2012-04-01', '2012-06-30', '10549, 10551, 12598'