0
問候我已經有喜歡集團由主要計數
select top 100 tab.user as username,
case tab.event
when 1 then 'Add'
when 2 then 'Remove'
when 3 then 'Update'
end as event,
count(tab.countOfEvents) as count_events
from history tab
where tab.even is not null and tab.date <= DATEADD(day, 1, getdate())
group by tab.event, tab.user
order by count_events desc
即時得到結果,如SQL一個問題:
user event count_event
a Update 100
b Update 89
a Add 19
c Remove 18
b Add 10
a Remove 9
現在是可能的是,我可以得到結果通過highes用戶活動排序(總和的activieties),但還是由用戶來分類(我需要事件名稱)例如:
user event count_event
a Update 100
a Add 19
a Remove 9
b Update 89
b Add 10
c Remove 18
etc ...
order by user,count_events desc – jarlh
您是否在搜索'order asc,count_events desc'? –
我無法在任何地方看到用戶活動字段:( – Arvo