SELECT c.WORK_DATE,
c.ONDUTY_TIME,
c.OFFDUTY_TIME,
group_concat(d.start_date) startDate,
group_concat(d.end_date) endDate,
group_concat(d.duty_explain) dutyExplain,
group_concat(d.duty_status_id) dutyStatusId FROM (SELECT a.WORK_DATE,
a.ONDUTY_TIME,
a.OFFDUTY_TIME,
b.DUTY_APPLY_ID FROM (SELECT ONDUTY_TIME,
OFFDUTY_TIME,
WORK_DATE,
SEQ_ID FROM tbl_duty WHERE USER_ID = 'xiaodong'
AND WORK_DATE >= '2012/3/20 星期二 0:00:00'
AND WORK_DATE <= '2012/3/29 星期二 0:00:00') a LEFT JOIN
tbl_duty_to_apply b ON a.seq_id = b.DUTY_ID) c LEFT JOIN
tbl_duty_apply d ON c.DUTY_APPLY_ID = d.SEQ_IDGROUP BY c.WORK_DATE;
1 回答
德玛西亚99
TA贡献1770条经验 获得超3个赞
理论上,家在 GROUP BY 之后
SELECT c.WORK_DATE, c.ONDUTY_TIME, c.OFFDUTY_TIME, group_concat(d.start_date) startDate, group_concat(d.end_date) endDate, group_concat(d.duty_explain) dutyExplain, group_concat(d.duty_status_id) dutyStatusId FROM (SELECT a.WORK_DATE, a.ONDUTY_TIME, a.OFFDUTY_TIME, b.DUTY_APPLY_ID FROM (SELECT ONDUTY_TIME, OFFDUTY_TIME, WORK_DATE, SEQ_ID FROM tbl_duty WHERE USER_ID = 'xiaodong' AND WORK_DATE >= '2012/3/20 星期二 0:00:00' AND WORK_DATE <= '2012/3/29 星期二 0:00:00') a LEFT JOIN tbl_duty_to_apply b ON a.seq_id = b.DUTY_ID) c LEFT JOIN tbl_duty_apply d ON c.DUTY_APPLY_ID = d.SEQ_IDGROUP BY c.WORK_DATE
添加回答
举报
0/150
提交
取消