if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YGS_OVER_DUE_FLAG
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YGS_OVER_DUE_FLAG
FROM t_social_info a
FROM t_social_info a
left join t_dispatch_info d on d.SOCIAL_ID = a.id
left join t_dispatch_info d on d.SOCIAL_ID = a.id
...
@@ -613,6 +615,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
...
@@ -613,6 +615,7 @@ if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.SOCIAL_END_DATE) or ( sd.id
a.HANDLE_STATUS,
a.HANDLE_STATUS,
a.YSD_HANDLE_STATUS,
a.YSD_HANDLE_STATUS,
d.id as DISPATCH_ID,
d.id as DISPATCH_ID,
d.type as DISPATCH_TYPE,
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.MEDICAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YSD_OVER_DUE_FLAG
if((sd.id is not null and NOW() <![CDATA[ <= ]]> sd.MEDICAL_END_DATE) or ( sd.id is null and DATE_FORMAT(d.AUDIT_TIME,'%Y%m') = DATE_FORMAT(now(),'%Y%m')),0 ,1) YSD_OVER_DUE_FLAG