LPS-41612 fix wrong SQL