I have requirement to export SQL Script data to an excel using C#.Net. Currently I face issue in avoiding duplicat values for columns, when a record has multiple values for a column it should look like as in the bellow, the entire record should not repeated for each values of the column.
should I handle it in application level or in Sql script. please advice me.
Currently I get data set and bind it to a grid view and then do the export to excel function.

for example Sql Data could be
select B.BID, B.BName, M.Year from tbl_B B inner join tbl_Master M ON B.BID = fm.BIDFK where B.BName = 'B9' Group By B.BID, B.BName, M.Year And the Result
