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 |
|
Steve95
Starting Member
19 Posts |
Posted - 2006-12-06 : 06:17:34
|
| Hi Alliam fairly new to SQL Server and am using SQL server 2005, QA. I have written the following query but keep getting an error msgselect *from dbo.domlogWHERE Database_name like '%Elite%' or Database_name like '%WUR%' or Database_name like '%ruf%' Group By Database_nameerror msg:Column 'dbo.domlog.lDate' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.Please can you help.....Also is their an easier way to write like = WUR, Elite, ruf instead me typing out the db name everytime?Many Thanks in advance... |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-06 : 06:26:51
|
What are you trying to accomplish?Try thisselect Database_name, count(*)from dbo.domlogWHERE Database_name like '%Elite%' or Database_name like '%WUR%' or Database_name like '%ruf%' Group By Database_name Peter LarssonHelsingborg, Sweden |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-12-06 : 06:30:16
|
Why need to GROUP BY? to avoid duplicates?SELECT DISTINCT Database_nameFROM dbo.domlogWHERE Database_name like '%Elite%' or Database_name like '%WUR%' or Database_name like '%ruf%' Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
|
|
|