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 2000 Forums
 Transact-SQL (2000)
 group by error

Author  Topic 

BitShift
Yak Posting Veteran

98 Posts

Posted - 2006-10-04 : 12:14:16
I get:
Incorrect syntax near the keyword 'as'. on the line that is doing the cast in the group by.

Im using a rollup for a report, and part of the group by clause doesnt like the following:

group by
cast(rtrim(b.ab_fstnm) + ' ' + rtrim(b.ab_lstnm) as char(30)) as AgentName,
s.insert_date,
s.id ,
f.id ,
ad.name,

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-04 : 12:24:35
You dont need Alias name in Group by

group by
cast(rtrim(b.ab_fstnm) + ' ' + rtrim(b.ab_lstnm) as char(30)),
s.insert_date,
s.id ,
f.id ,
ad.name,


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-04 : 18:34:17
You can't use alias in GROUP BY


KH

Go to Top of Page
   

- Advertisement -