sql query updates

Still need to do author page