Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Msg 102, Level 15, State 1, Line 2

Author  Topic 

asifpasha07
Starting Member

1 Post

Posted - 2012-07-09 : 04:36:44
Hello forum,

I am new to SQL query, facing some error in terms of getting a data through pivot.

select [AIA],[TLS] from CSS_TEST
pivot (count ([TLS]) for [AIA] in ([AIA],[ERACI],[No]))

AIA is the colum header as wel as the content in the column.

Error: Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ')'.


Your quick responce will be a great help
thanks



Asif pasha

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-07-09 : 07:33:07
You need to give an alias to the pivoted table
select [AIA],[TLS] from CSS_TEST
pivot (count ([TLS]) for [AIA] in ([AIA],[ERACI],[No])) AS P
Go to Top of Page
   

- Advertisement -