You have the right idea with the query but you haven't really said in what way it isn't working (although you still need to correct all the errors I listed above still) or errors you are getting.