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 |
|
hai
Yak Posting Veteran
84 Posts |
Posted - 2007-10-15 : 15:35:27
|
| table structure:id,fd1,fd2,fd3,fd4,ti:I need to select id, fd1,fd2,fd3,fd4,max(ti) from tablegroup by fd1,fd2,fd3,fd4. I get error complaining id is invalid in the select list because it is not contained in either an aggregate function or the GROUP BYany help on this is greatly appreicate...thankswindows 2003 sql 2005 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-15 : 15:46:23
|
| You need to EITHER include [id] in the GROUP BY clause, or apply an aggregate function to it - like MAX(ID)Kristen |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2007-10-16 : 11:30:23
|
| One strategy you could apply to get around this problem is to break the sql statement down into 2 parts, do an initial CTE , for the preliminary work and then do the second statmentJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
|
|
|
|
|