2
Answers

SQl :ATTENDANCE

Sreekanth

Sreekanth

15y
2.8k
1

i have a table:ABC
id    date        name  attendance
1    1/1/2009     a      1
2    1/1/2009     b      0
3    2/1/2009     a      0
4    2/1/2009     b      1  
here attendance 1 for present 0 for absent

i need thedetails of attendance as following when one istaking report of ABC

eg:data between 1/1/2009 and 2/1/2009

name,1/1/2009 2/2/2009
a     present  leave
b      leave    present

i done this throug following sql query using case
but my table is not small.
and it take long time to get the result.
beacause in my case when one take reprt of 1/1/2009 to 30/1/2009
i must have to put condition in a loop with case.
and my query take long long time top execute..
Any other method to sole this time delay?
plsssssssssssssss

Answers (2)
0
Vikrant More

Vikrant More

NA 1.5k 166.3k 12y

Attachment attendance.rar

hey i tried this in some different way just give it a try,
i am using ABC Table as you give in the above example and considering the column you gave in it.
if the attached code is also taking time then try with using query hints like (nolock) , creating index on table columns etc.

Thanks!
0
Vikrant More

Vikrant More

NA 1.5k 166.3k 12y
Hi,

i think here is the typo in date insted of 2/1/2009 you have put 2/2/2009 name,1/1/2009 2/2/2009

if possible can you please put your query/code here. to see where you are missing.

Thanks!
Next Recommended Forum