sql - TSQL query with group by error -


i have query running return stats tool. working returning information have added new column able totals location , stuck.

below query:

 select   b.[segmentname],                  count(a.[segmentid]) total,                  a.[meetingid],                  c.[center]             focus_meetings_segments                  inner join                  focus_segments b                  on a.[segmentid] = b.[id]                  join focus_meetings c                  on c.[id] = a.[meetingid]         c.[center] = @location         group a.[segmentid], b.[segmentname]         order total desc              xml path ('segment'), type, elements, root ('root'); 

the new column added center focus_meetings table.

the error getting meetingid not contained in aggregate or group clause.

is there way write query can run?

change group a.[segmentid], b.[segmentname]

to group b.[segmentname], a.[meetingid], c.[center]


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -