mysql cast方法
Db('study_report_day_info_sp')->field('id,rel_id, max(CAST(video_length as SIGNED)) as m')
->where('type',$type)
->where('coid',$coid)
->where('user_id',$user_id)
->group('rel_id')
->order('video_length desc')
->select();
CAST 和 CONVERT 两个函数中的 type取值可以为:SIGNED,UNSIGNED, DECIMAL,DATE,TIME, DTAETIME等
Db('course')->connect('rongyue')
->field('couid, TIME_TO_SEC(duration) as c')
->where(['coid' => $coid])
->select();
SEC_TO_TIME(second) 秒换算成时分秒
TIME_TO_SEC(date) 时分秒换算成秒

浙公网安备 33010602011771号