When I said "flat" I meant from the "relational structure" point of view. For example you have a Parent and two children, then you can represent this by
parent1, child1
parent1, child 2
or parent1,child1,child2
anyways, I have resolved it by using "for xml path" and using "Select sub-queris".