When trying to solve the SQL query problems I always start out by trying to solve it first using manual SQL commands in the command line tool, before implementing the query in code. -Paul-