Click here to Skip to main content
15,892,797 members
Home / Discussions / Database
   

Database

 
GeneralRe: array or new table for every user , which one ? Pin
Wayne Gaylard12-Jan-12 0:10
professionalWayne Gaylard12-Jan-12 0:10 
GeneralRe: array or new table for every user , which one ? Pin
Shameel13-Jan-12 9:06
professionalShameel13-Jan-12 9:06 
QuestionHow to Insert Record In MYSQL Pin
Anubhava Dimri11-Jan-12 19:19
Anubhava Dimri11-Jan-12 19:19 
AnswerRe: How to Insert Record In MYSQL Pin
Wayne Gaylard11-Jan-12 22:20
professionalWayne Gaylard11-Jan-12 22:20 
AnswerRe: How to Insert Record In MYSQL Pin
SilimSayo12-Jan-12 5:53
SilimSayo12-Jan-12 5:53 
GeneralRe: How to Insert Record In MYSQL Pin
Shameel13-Jan-12 9:08
professionalShameel13-Jan-12 9:08 
AnswerRe: How to Insert Record In MYSQL Pin
sri08018819-Jan-12 0:27
sri08018819-Jan-12 0:27 
QuestionSum the Counts Pin
Elizabeth Rani8-Jan-12 23:12
Elizabeth Rani8-Jan-12 23:12 
Hi All,

Iam new to database. Here iam using sql server 2000. i want to sum the counts from a table. I need this to calculate the employees who have come late in a week/month.

Example: I have table such as

Table1:tbl_attandence(it contains the employee id and the intimings and outtime)
Fields:empcode,intime,outime

Eg: EMP001,11/1/2011 09:30:45 AM,11/30/2011 06:30:15 PM


I am attaching my code such that it return the count but iam unable to sum the values because it is showing the result as shown below

DECLARE @actualTime DATETIME
DECLARE @lateTime DATETIME
SELECT @actualTime = '9:41'
Select @lateTime ='10:00'

select count(convert(varchar,intime,105)) as dates,CONVERT(VARCHAR(5),intime,108) AS Hours from tbl_attendance
where empcode='EMP001';
and intime between '2011-11-01' and '2011-11-30'
and CONVERT(VARCHAR(5),intime,108) >=@actualTime and CONVERT(VARCHAR(5),intime,108) <= @lateTime
group by CONVERT(VARCHAR(5),intime,108)

OytPut:

days intime
1 09:41
1 09:44
1 09:46
2 09:53
1 09:54

Now i need to sum all the days and get the sum as 7

Please suggest that how can i do this task any help will be appreciated
AnswerRe: Sum the Counts Pin
Mycroft Holmes8-Jan-12 23:51
professionalMycroft Holmes8-Jan-12 23:51 
QuestionDatabase Restor Pin
Danzy838-Jan-12 8:05
Danzy838-Jan-12 8:05 
AnswerRe: Database Restor Pin
manognya kota8-Jan-12 22:35
manognya kota8-Jan-12 22:35 
AnswerRe: Database Restor Pin
Eddy Vluggen9-Jan-12 8:05
professionalEddy Vluggen9-Jan-12 8:05 
QuestionResetting 'Identity Specification' column in Sql Table Pin
AmbiguousName5-Jan-12 20:56
AmbiguousName5-Jan-12 20:56 
AnswerRe: Resetting 'Identity Specification' column in Sql Table Pin
Ellen_South_Africa5-Jan-12 21:15
Ellen_South_Africa5-Jan-12 21:15 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
AmbiguousName9-Jan-12 6:08
AmbiguousName9-Jan-12 6:08 
AnswerRe: Resetting 'Identity Specification' column in Sql Table Pin
unclejimbob6-Jan-12 1:26
unclejimbob6-Jan-12 1:26 
JokeRe: Resetting 'Identity Specification' column in Sql Table Pin
SilimSayo6-Jan-12 6:04
SilimSayo6-Jan-12 6:04 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
unclejimbob6-Jan-12 14:21
unclejimbob6-Jan-12 14:21 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
Mycroft Holmes6-Jan-12 20:26
professionalMycroft Holmes6-Jan-12 20:26 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
unclejimbob6-Jan-12 21:16
unclejimbob6-Jan-12 21:16 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
Mycroft Holmes7-Jan-12 13:24
professionalMycroft Holmes7-Jan-12 13:24 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
unclejimbob7-Jan-12 17:33
unclejimbob7-Jan-12 17:33 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
Mycroft Holmes7-Jan-12 19:52
professionalMycroft Holmes7-Jan-12 19:52 
GeneralRe: Resetting 'Identity Specification' column in Sql Table Pin
jschell9-Jan-12 10:10
jschell9-Jan-12 10:10 
QuestionRETURN; before END Pin
Waldemar Sauer4-Jan-12 6:05
Waldemar Sauer4-Jan-12 6:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.