fix sql for page