SQL question will be used later in Excel

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,648
Hello Everyone,

I have a cross table query in Access that I need to run in SQL Server. Here is the code:

Code:
TRANSFORM Sum([track apps].Apps) AS SumOfApps
SELECT [track apps].Branch
FROM [track apps]
GROUP BY [track apps].Branch
PIVOT [track apps].MONTH;

I am running SQL Server 2005.

I get the error message:

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'trackapps'.
Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near 'PIVOT'.

I would appreciate any help on this.

TIA

Kurt
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,648
Additional info

Hello again,

I am also trying to get this to work in Excel vba.

I forgot to add that.

Thanks,

Kurt
 

mbb4331

Board Regular
Joined
Dec 22, 2005
Messages
152
How about bringing the data straight from SQL into Excel, then do a pivottable.
 

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,648
Pivot table

Hello,

Yes I am looking at that possibility also.


Kurt
 

kylefraney

Board Regular
Joined
Mar 21, 2003
Messages
127
I'm unsure as to what the error is but in the past I've cut and pasted SQL statements from Access to Excel via MS Query. Just another option I thought I would throw out there.
 

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,648
MS Query

Hello Kyle,

Thanks for your suggestion.

I am also looking at MS Query you can get a SQL View there as well.

Kurt
 

Watch MrExcel Video

Forum statistics

Threads
1,108,492
Messages
5,523,262
Members
409,506
Latest member
reneekeane

This Week's Hot Topics

Top