Bugfix SQL bug when incomplete END_DATE