add filter to sql cmd custom.turn_onoff_log.uid = sd.equipment.uid