I have a complex SQL query and I want to manipulate resultant data based on certain conditions.
Here is a look at my data structure. It\'s a combination of 3 tables which