change SQL style of getPages()