I have this query which looks something like,
 
(
SELECT count(*) AS tCount, amount, block 
FROM table_a
GROUP BY amount, block
)
UNION
(
SELECT count(*) AS tCount, amount, block 
FROM table_b
GROUP BY amount, block
)
ORDER BY amount;
 
tCount    amount    block
3            400            A    <-- from table_a
1            400            A    <-- from table_b
2            400            B    <-- from table_a
5            600            A    <-- from table_a
5            600            A    <-- from table_b
5            600            B    <-- from table_a
5            600            B    <-- from table_b
 
how can i do a SUM on tCount and GROUP BY amount and block with this two
set of record?
 
result should be like this
 
tCount    amount    block
4           400            A
2            400            B
10          600            A
10          600            B
 
 
Thanx
Jimmy
 

Reply via email to