Fix getTimeBetweenBlocks SQL Error