Viewing 15 posts - 16 through 30 (of 39 total)
Thanks for all of your input. I was able to get what I needed from the scripts everyone provided.
November 7, 2017 at 8:52 am
That's pointing me in the right direction. I was thinking more in line of pivoting on the cycle ids, but I should be able to work that out
Thanks
November 6, 2017 at 12:54 pm
That did it. Thanks for all your help
; WITH Employee( EmployeeID, FirstAwardYear) AS (
SELECT tr.EmployeeID, YEAR(MIN(tr.AwardDate))
FROM #tmpRecord tr
WHERE tr.Award = 1
GROUP BY tr.EmployeeID
)
SELECT FirstAwardYear, COUNT(EmployeeID)
FROM Employee
GROUP BY Employee.FirstAwardYear
January 3, 2017 at 9:57 am
Let me clean up my data so you can get exact expected results
January 3, 2017 at 9:42 am
Getting there, but if they received an award in a previous year then they should not be counted as a first time award receiver in later years.
EX. Employee receives first...
January 3, 2017 at 9:27 am
Yes, you are correct. Sorry if I was misleading,
Also, if they received an award in a previous year then they should not be counted as a first time award...
January 3, 2017 at 8:53 am
Sample data provided in previous post expected output would be
Year Number of First Time Award recipients
2012 40
2013 ...
January 3, 2017 at 8:45 am
CREATE TABLE [dbo].[tmpRecord](
[EmployeeID] [int] NULL,
[Award] [bit] NULL,
[AwardDate] [datetime] NULL
) ON [PRIMARY]
GO
INSERT [dbo].[tmpRecord] ([EmployeeID], [Award], [AwardDate]) VALUES (1, 0, NULL)
GO
INSERT [dbo].[tmpRecord] ([EmployeeID], [Award], [AwardDate]) VALUES (2, 1, CAST(N'2011-01-22T14:10:26.560' AS DateTime))
GO
INSERT [dbo].[tmpRecord]...
January 3, 2017 at 8:35 am
Thank you, just what I needed
October 13, 2016 at 9:27 am
Thanks, sorry for the bad scripting on my part. I'll see what I can work out
May 26, 2016 at 11:57 am
Thanks, I think I can work with this. One quick question. Suppose the ticket column gets a value of 1 if it is a speeding ticket and a...
September 23, 2015 at 9:33 am
I think we're close, I'm looking to count the number of people who have received their 2nd ticket during the given time. Not the number of tickets per individual.
Thanks
EDIT:...
September 23, 2015 at 9:06 am
Thanks, that works for me.
July 10, 2015 at 11:10 am
The FY does not match up with Calendar year.
What I'm ultimately looking for are the number of records in a given FY where the RecordDate was from Oct...
July 10, 2015 at 9:54 am
Viewing 15 posts - 16 through 30 (of 39 total)