James
2012-04-03 16:14:59 UTC
We have a TimeCard table like so: (stripped down example)
CREATE TABLE [dbo].[TimeCard](
[pk] [int] IDENTITY(1,1) NOT NULL,
[employee] [int] NOT NULL,
[punchIn] [datetime] NOT NULL,
[punchOut] [datetime] NULL,
[TardyType] [int] NOT NULL,
)
And the last column 'TardyType' can be one of these (0 = Not Tardy, 1
= Tardy, 2 = Tardy but Approved in Advance, 3 = Other)
I am trying to create a View to query the data, By Employee, For a
given time period (punchIn date range) and get the number of
occurrences of each value for each employee over the time period sort
of like this
Employee Type0 Type1 Type2 Type3
-------------- ------- ------- ------- -------
1 10 2 3 0
2 8 3 4 0
etc...
**** NOTE: This is an SQL Server 2000 database for now
Ideas?
Thanks in advance
JIM
CREATE TABLE [dbo].[TimeCard](
[pk] [int] IDENTITY(1,1) NOT NULL,
[employee] [int] NOT NULL,
[punchIn] [datetime] NOT NULL,
[punchOut] [datetime] NULL,
[TardyType] [int] NOT NULL,
)
And the last column 'TardyType' can be one of these (0 = Not Tardy, 1
= Tardy, 2 = Tardy but Approved in Advance, 3 = Other)
I am trying to create a View to query the data, By Employee, For a
given time period (punchIn date range) and get the number of
occurrences of each value for each employee over the time period sort
of like this
Employee Type0 Type1 Type2 Type3
-------------- ------- ------- ------- -------
1 10 2 3 0
2 8 3 4 0
etc...
**** NOTE: This is an SQL Server 2000 database for now
Ideas?
Thanks in advance
JIM