SQL syntax fix for indexes