I'm running a query to return multiple rows of employee hours data from multiple tables. There is a valid condition of employees putting a day shift of 8 hours per day to multiple customers for billing purposes. I want to update the "Index" column with a unique index for any duplicate across 3 columns
eg.
Emp Hrs Date Index
Fred 8 11/7 1
Fred 8 11/7 2
Fred 8 11/7 3
Fred 10 12/7 1
Fred 9 13/7 1
In the Select statement these is a Case statement which returns a value in the Index column for a duplicate but it doesn't give a unique value
case when count(*) over (partition by Emp, Hrs, Date) > 1
then 1
else 0
end
can I include a group by condition in a case statement to achieve this?