I\'ve struggled with this query for two days. I have three tables. the relation among them is one to many.
Here is more details
Table 1:
CREATE TABL