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.
| Author |
Topic |
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2006-02-24 : 15:37:18
|
| Hello guys!In Access you may have a select in the "FROM" section, instead of a table. Is this possible in SQL-SERVER 2005?Here is an example that gives me the error "Incorrect syntax near the keyword 'GROUP'." : SELECT LogCreateDate, count(LogUserName) as LoggedUsersFROM(SELECT distinct dbo.EventLog.LogCreateDate, dbo.EventLog.LogUserNameFROM dbo.EventLogWHERE dbo.EventLog.LogTypeKey = 'Login_Success')GROUP BY LogCreateDateThank you very much for any help !Regards,Fabianmy favorit hoster is ASPnix : www.aspnix.com ! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-02-24 : 15:38:48
|
Yes it is possible, but you must alias the derived table.SELECT LogCreateDate, count(LogUserName) as LoggedUsersFROM( SELECT distinct dbo.EventLog.LogCreateDate, dbo.EventLog.LogUserName FROM dbo.EventLog WHERE dbo.EventLog.LogTypeKey = 'Login_Success') tGROUP BY LogCreateDate t is the alias that I have used.Tara Kizeraka tduggan |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-02-24 : 15:38:52
|
| I think u have to have alias Select ... from (select ... from ...) as Q1 |
 |
|
|
fabianus76
Posting Yak Master
191 Posts |
Posted - 2006-02-24 : 15:53:51
|
| Hi Tara, Hi Srinika,thank you for your prompt responses !It is really inscribable how fast the responses come in this forum – thank you for this great job!Regards,Fabianmy favorit hoster is ASPnix : www.aspnix.com ! |
 |
|
|
|
|
|