reporting services - SSRS 2008 - Count instances of a returned result -


in ssrs need identify how many times driver logs onto system between user specified dates - have report displaying [driver] "loggedon at" [timeon] "logged off at" [timeoff] "for duration of" [timeoff-timeon] (a bit more thats bones).

the resulting report looks , works fine:

david niven logged on @ .... duration of 3 hours  john jones logged on @ ... duration of 7 hours  david niven logged on @ ... duration of 5 hours  david niven logged on @ ... duration of 2 hours  paul newman logged on @ .... duration of 3 hours etc etc 

what need provide summary - ie between user specified dates

david niven logged on 3 times total duration of 10 hours john jones logged on 1 time total duarion of 7 hours paul newman logged on 1 time total duartion of 3 hours 

can use expression add number of times each driver logged on in ssrs 2008 , how long ? - if so, how - can give more specific example of query if needed ... many many in advance

you can use 2 different queries, using grouping , sub-query:

declare @driverinfo table (     name varchar(50),     timeon datetime,     timeoff datetime )  insert @driverinfo select 'david niven', '2013-07-23 09:00', '2013-07-23 12:00' union select 'john jones', '2013-07-23 09:00', '2013-07-23 16:00' union select 'david niven', '2013-07-23 13:00', '2013-07-23 18:00' union select 'david niven', '2013-07-24 09:00', '2013-07-24 11:00' union select 'paul newman', '2013-07-23 09:00', '2013-07-23 12:00'  -- used first data set select *, datediff(hour, timeon, timeoff) [totalhours] @driverinfo  -- used second data set select name, count(*), sum(totalhours) (     select name, datediff(hour, timeon, timeoff) [totalhours]     @driverinfo ) s group s.name 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -