Question : can't fix this syntax error

I ran this query but get a invalid column name error when those columns DO EXIST. I did a select script and it gave me those columns....they are also in the table
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:
47:
48:
49:
50:
51:
52:
53:
54:
55:
SELECT [Company Name]
      ,[SCAC]
      ,[Carrier_type]
      ,[SOURCE]
      ,[shipment_Id]
      ,[segment]
      ,[group]
      ,[division]
      ,[division_city]
      ,[carrier]
      ,[mode]
      ,[invoice_date]
      ,[ship_from_company]
      ,[ship_city]
      ,[ship_state]
      ,[ship_zip]
      ,[ship_country]
      ,[recipient_company]
      ,[recipient_from_addr]
      ,[recipient_city]
      ,[recipient_state]
      ,[recipient_zip]
      ,[recipient_country]
      ,[delivery_date]
      ,[bill_weight]
      ,[quantity]
      ,[freight_class]
      ,[chg_type]
      ,[entry_type]
      ,CHARGES
      ,[commodity]
      ,[paid_date]
      ,[gl_number]
      ,[INV_WEEK_ID]
      ,INV_MONTH_ID
      ,[INV_YEAR_ID]
      ,[bill_of_lading]
      ,[purchase_order]
      ,[Date_Shipped]
      ,[OrderRef]
      ,[Miles]
  FROM [TRANS].[dbo].[FRAK_ACCU_SCAC_tbl]
PIVOT 
(sum(charges) 
 For Inv_Month_ID
 In ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])
 ) pivottbl




Msg 207, Level 16, State 1, Line 30
Invalid column name 'CHARGES'.
Msg 207, Level 16, State 1, Line 35
Invalid column name 'INV_MONTH_ID'.

Answer : can't fix this syntax error

Random Solutions  
 
programming4us programming4us