I have a table like left in below image. I want to group by field like right in below image. Does anyone have an idea to make this query? Thank you in adva