- create table #ExamDur(DtTm datetime,startTm datetime,EndTm datetime,Duration int,duration1 varchar(20))
-
insert into #ExamDur(DtTm,startTm,EndTm,Duration,duration1)
-
select UE.CreatedDtTm,ED.StartTime,ED.EndTime,
-
datediff(mi,ed.starttime,ed.endtime) duration ,
-
cast(datediff(mi,ED.StartTime,ED.EndTime)as varchar(20))+':'+
-
cast(DATEPART(SECOND,(ed.EndTime-ed.StartTime) )as varchar(20)) Duration1
-
from UserExamMap UE left join ExamDuration ED on UE.Id=ED.ExamId where UE.UserId=1--@UserID
-
-
-
select p.Sno SNo,p.dt Date,p.chapter Chapter,p.chpaterid ChapterID,p.userid UserID,p.topic Topic,p.marks Marks
-
,p.percentage Percentage,cast(datepart(HOUR,ED.Duration1) as varchar(10))+':'+cast(datepart(MINUTE,ed.duration1)as varchar(10)) ExamDuration1 from #ExamDur ED inner join #Practice p on p.dt=ED.DtTm order by p.Sno
-
-
select Duration AvgTmSpent from #ExamDur
-
-
end
1 2795
Please use code tags when posting code.
To calculate the average duration, I would use DATEDIFF to get the number of seconds between the two date times and use an aggregate query to calculate the average.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Sara |
last post by:
I am trying to find the average number of products of the set that is
on rows...dynamically.
For example, if I had states on rows and was looking at the average
number of products, I would see...
|
by: J |
last post by:
Kind of new at programming/vb.net. I'm doing this junky die roller
program.
Heres's what is supposed to happen:
Roll 2 6-sided dies. Add rolls together put total in
rolls(d6total).
Display...
|
by: Gary |
last post by:
Hi, I have a temperature conversion program down pat, but I was told to
add an average, meaning, i need to get the average temperature for as
many times as it was entered. i do not know where to...
|
by: C++Geek |
last post by:
I need to get this program to average the salaries. What am I doing
wrong?
//Program to read in employee data and calculate the average salaries
of the emplyees.
|
by: simpleeshelbee |
last post by:
Hey guys,
This is my second post and is URGENT!!!! My final assignment is due tonite for class and I have no idea how to write this program right!
I am supposed to write a program that uses a...
|
by: mochatrpl |
last post by:
I am looking for a way to make a query / report display the running
average for total dollars.
I have already set up a query to provide totals dollars per day from
which a report graphly shows...
|
by: Salad |
last post by:
http://www.mathwords.com/w/weighted_average.htm
At the above link gives an example of a weighted average. It uses the
following example:
Grades are often computed using a weighted average....
|
by: vileoxidation |
last post by:
Hello, and thanks for any help in advance!
Basically, as the title says, I am looking for a way to print the number of times the user gave the program an input, and then also print the average of...
|
by: p3rk3le |
last post by:
So, I'm about to do a sequential search on a table (n contents) of random numbers.
I have to print
the average between the number of comparisons and the contents of the table (n)
and the...
|
by: Ormazd |
last post by:
Hello,
I was wondering if anyone might be able to help me with a little PERL script? I'm very new and I have been given a task to write a simple Perl script that prints out the file names and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |