Please read the first article in my signature on how to ask a question in this forum.
It'll show you how to post table def and sample data in a ready to use format.
Also, please include your expected output (not as jpg) and what you've tried so far.
Right now it looks like homework...