select ws.id from PLMWorkScheduleItems ws where ws.status in (0,1,2) order by case when (ws.datefrom$date > 0) then 0 else 100 end + case when (ws.workplace_id is not null) then 0 else 1 end, ws.Priority
Generated by ABRA Software a.s. 27.10.2021 16:34:49