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 |
|
retropost
Starting Member
1 Post |
Posted - 2005-03-02 : 18:09:54
|
| Could someone give me some help on inserting the field PRContactAssoc.Role with this script? (Error received is below)The data is "GROUP BY PRContactAssoc.WBS1, Contacts.ClientID" because these two fields together create the primary key for the PRClientAssoc table. Thanks a LOT! - SINSERT INTO PRClientAssocSELECTPRContactAssoc.wbs1, Contacts.ClientID, 'N', null, Null, PRContactAssoc.Role, 'N', 'ADMIN', Null, 'ADMIN', NullFrom PRContactAssocInner JoinContactsonPRContactAssoc.ContactID = Contacts.ContactIDWHEREContacts.FirstName not like 'Office' andnot exists(select 'x' from PRClientAssoc wherePRContactAssoc.WBS1 = PRClientAssoc.WBS1 andContacts.ClientID = PRClientAssoc.ClientID)GROUP BY PRContactAssoc.WBS1, Contacts.ClientIDServer: Msg 8120, Level 16, State 1, Line 1Column 'PRContactAssoc.Role' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-03-02 : 19:11:26
|
| The error message says it all.either: you include PRContactAssoc.Role in the group by,or you contain it in an aggregate function, eg. min(PRContactAssoc.Role) as RoleNext question:in the query, will there be any difference betweena) min(PRContactAssoc.Role)b) max(PRContactAssoc.Role)??????Motivate Your answer.rockmoose |
 |
|
|
|
|
|
|
|