Got relational queries working