implemented a proof of concept select() function with really bad query interface