Link to home
Create AccountLog in
Avatar of Will
WillFlag for United States of America

asked on

Looking to get a count of procedural steps in an sql view

I am doing a rank over partition in an attempt to get a unique count of procedural steps.  the problem is the partition field is not unqiue, and I am trying to increment the step:  Here is a sample from the data:

User generated image
the approach I am using is:

case when Type='Procedure' then rank() OVER (partition by Type ORDER BY ActionDate) end as PSeq, 

Open in new window


I understand why the 5 is repeating because I am using actiondate and the two dates are the same.

Any thoughts how I can get around this since the second 5 needs to be a 6.

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Will

ASKER

Thank you