Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 TimeAttendance problem

Author  Topic 

roko1234
Starting Member

2 Posts

Posted - 2010-08-16 : 07:42:23
I have a table on SQL server:

TimeAttendance:

-UserID

-StartTime

-EndTime



From this table i would like to display the following:

Period UserID Minutes

00:00 - 01:00 1 37

00:00 - 01:00 2 60

00:00 - 01:00 5 60

01:00 - 02:00 1 37

01:00 - 02:00 2 60

01:00 - 02:00 5 60
...
22:00 - 23:00 ...
23:00 - 00:00 ...

.... and so on for other hours in day.

Can somebody help please...

Sachin.Nand

2937 Posts

Posted - 2010-08-16 : 07:44:38
What is the data in your table TimeAttendance?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

roko1234
Starting Member

2 Posts

Posted - 2010-08-16 : 07:52:51


1 2009-05-10 07:26:40.000 2009-05-10 10:43:05.000 0 0 True
1 2009-05-10 10:43:33.000 2009-05-10 16:54:50.000 0 0 True
1 2009-05-11 07:08:42.000 2009-05-11 13:41:42.000 0 0 True
1 2009-05-11 13:41:50.000 2009-05-11 13:42:46.000 0 0 True
1 2009-05-11 13:42:53.000 2009-05-11 15:03:17.000 0 0 True
1 2009-05-12 06:58:05.000 2009-05-12 15:12:41.000 0 0 True
1 2009-05-13 06:59:51.000 2009-05-13 15:30:54.000 0 0 True
1 2009-05-15 14:49:28.000 2009-05-15 23:31:17.000 0 0 True
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-08-16 : 08:09:56
quote:
Originally posted by roko1234



1 2009-05-10 07:26:40.000 2009-05-10 10:43:05.000 0 0 True
1 2009-05-10 10:43:33.000 2009-05-10 16:54:50.000 0 0 True
1 2009-05-11 07:08:42.000 2009-05-11 13:41:42.000 0 0 True
1 2009-05-11 13:41:50.000 2009-05-11 13:42:46.000 0 0 True
1 2009-05-11 13:42:53.000 2009-05-11 15:03:17.000 0 0 True
1 2009-05-12 06:58:05.000 2009-05-12 15:12:41.000 0 0 True
1 2009-05-13 06:59:51.000 2009-05-13 15:30:54.000 0 0 True
1 2009-05-15 14:49:28.000 2009-05-15 23:31:17.000 0 0 True



So is the logic to get the desired o/p you posted with the above data?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-16 : 09:39:42
What are "0", "0" and "TRUE"?


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -