I am trying to write an complex mySQL query in which there are 2 tables action and revenue what I need is: