The SQL in this project was written before I knew SQL. As such it needs to be re-written to minimize unnecessary overhead on the server.