Above table is my data from multiple tables, and I want to be query on it like, its result will be shown as below
I tried using group by clause but sa