I have 3 tables T1, T2, T3. Each of them is related to the other.



SELECT T1.T1_Serno, T2.T2_Serno, T3.T3_Serno, T1.T1,COUNT( T3.T3_Serno) as Count_1, T2.T2, T3.T3, T3.Quantity
FROM T1 INNER JOIN
T2 ON T1.T1_Serno = T2.T1_Serno INNER JOIN
T3 ON T2.T2_Serno = T3.T2_Serno
GROUP BY T1.T1_Serno, T2.T2_Serno, T3.T3_Serno, T1.T1, T2.T2, T3.T3, T3.Quantity
and result

I want to get Count_1 to show me how many T3 there are, and Count_2 to have a relative count of the number of T3. I expect a result like
T2 T3 Count_1 Count_2
Apple Apple1 3 80
Apple Apple2 3 80
Apple Apple3 3 80
-------
Google Google1 1 40
------
Nokia Nokia1 1 15
So, when I put this in the grid, I can use Counts as a Footer. Something like this, but with totals below each group.

source
share