update raw sql call to work across versions