Its simply the case of one to many relation ship for one heading you can have more than one title.
if you are showing these records in a table. Then you can sort the result by Heading. Then in each row check if current row heading is same as in previous row then left blank for current row. If different then add heading.
Also you can write a SQL query to get the desired output, you need to use STUFF in SQL query to get the titles for each heading.
Regards