| Author |
Topic  |
|
|
suketu9
Starting Member
13 Posts |
Posted - 12/04/2006 : 12:31:20
|
I am trying to run this query but keep getting "Incorrect Syntax near keyword 'AS'. Not sure what is wrong:
select bbr_object_name, DATEPART(day, bbr_value_date) AS 'day', DATEPART(month, bbr_value_date) AS 'month', DATEPART(year, bbr_value_date) AS 'year', DATEPART(hour, bbr_value_date) AS 'hour', avg("Value") AS 'average', stdev("Value") AS 'stdev', count * AS 'count' from icBoaSwitchLastTransferFV group by datepart(day, bbr_value_date), datepart(month, bbr_value_date), datepart(year, bbr_value_date), datepart(hour, bbr_value_date), bbr_object_name order by year, month, day, bbr_object_name |
|
|
TG
Flowing Fount of Yak Knowledge
USA
5467 Posts |
Posted - 12/04/2006 : 12:42:12
|
count(*) not count *
Be One with the Optimizer TG |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
Posted - 12/04/2006 : 13:40:22
|
Also, what is about the double quotes (") for the column name Value?
Peter Larsson Helsingborg, Sweden |
 |
|
|
TG
Flowing Fount of Yak Knowledge
USA
5467 Posts |
Posted - 12/04/2006 : 13:58:19
|
yeah,
My own preferences and I believe best practices are:
refer to (and alias) column names with square brackets: select [value] as [stdev]
and only use single quotes for quoted strings (and to ESCAPE an appostrophe): select 'O''Connell' as [LastName]
and never use double quotes in t-sql code (even though BOL examples use them)
Be One with the Optimizer TG |
 |
|
| |
Topic  |
|
|
|