Question : SQL Syntax Question

I have a query of a table that I am doing several sums on to aggregate some dollar values from the table.  I am then grouping them on field 1, field 2, and field 3.  I need to add a column to the query to do a sum on a dollar amount in a separate table and join this column on field 1, field 2, and field 3 from the initial query.  Not sure how the syntax is supposed to be.

Answer : SQL Syntax Question

Alternatively, try the following:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
SELECT Y.LEA,
       Y.[Funding Type],
       Y.[FY],
       Y.[Current Allocation],
       Y.[Current Contract],
       Y.[Current Expenditure],
       Z.[Total Contingency]
FROM
       ( SELECT c.county_name AS LEA,
              s.source_of_fund AS [Funding Type],
              substring(f.psc_no, 6, 4)AS [FY],
              SUM(f.current_allocation) AS [Current Allocation],
              SUM(f.current_contract) AS [Current Contract],
              SUM(current_expenditure) AS [Current Expenditure]
       FROM   source_of_fund_transaction f
       JOIN   county c
       ON     substring(f.psc_no, 1, 2)=c.county_number
       JOIN   source_of_fund s
       ON     f.sof_id=s.sof_id
       WHERE  NOT (f."TRANSACTION_TYPE"='C/O Decline'
              OR f."TRANSACTION_TYPE"='C/O Posting'
              OR f."TRANSACTION_TYPE"='Post Contract')
       GROUP BY c.county_name,
              s.source_of_fund,
              substring(f.psc_no, 6, 4)
       ) Y
LEFT OUTER JOIN
       (SELECT county_name AS LEA,
              source_of_fund AS [Funding Type],
              substring(psc_no, 6, 4) AS FY,
              SUM(amount) AS [Total Contingency]
       FROM   project_contingency p
       JOIN   source_of_fund s
       ON     p.sof_id=s.sof_id
       JOIN   county c
       ON     substring(psc_no, 1, 2)=county_number
       GROUP BY s.source_of_fund,
              county_name,
              substring(psc_no, 6, 4)
       ) Z
ON     Y.LEA = Z.LEA
       AND Y.[Funding Type] = Z.[Funding Type]
       AND Y.[FY] = Z.[FY]
ORDER BY Y.LEA,
       Y.[Funding Type],
       Y.[FY]
Random Solutions  
 
programming4us programming4us