totally stuck with this query
And what is your problem? What are you trying to achieve? What do you have so far and in what way it's not (yet) what you need?