Subject SQL syntax for 4 table query?
Author petesouthwest
Hi

Can anyone tell me what the syntax is to sum the data from 4
different tables?

I have tried:
SELECT tab1.key1,
tab1.col11,tot2.sum2,tot3.sum3,tot4.sum4,tot5.sum5
FROM tab1
JOIN (SELECT key1,SUM(field) AS sum2
FROM tab2
GROUP BY key1) AS tot2
ON tot2.key1 = tab1.key1
JOIN (SELECT key1,SUM(field) AS sum3
FROM tab3
GROUP BY key1) AS tot3
ON tot3.key1 = tab1.key1
JOIN (SELECT key1,SUM(field) AS sum4
FROM tab4
GROUP BY key1) AS tot4
ON tot4.key1 = tab1.key1
JOIN (SELECT key1,SUM(field) AS sum4
FROM tab5
GROUP BY key1) AS tot5
ON tot5.key1 = tab1.key1

But when i try and test this it appears to object about the
first '(select' statement.

Thanks for any help given
Pete