Sequential Numbers with ID & Duplicate Dates (1 Viewer)

xstine

New member
Local time
Yesterday, 19:08
Joined
Dec 31, 2019
Messages
5
I followed the steps in this thread and it worked well, except the numbering is in the opposite order of what I would like. The oldest date I would like the numbering to start at 1, then 2 etc. Based on duplicate EE ID #s.

I have tried sorting it in the org query by EE# then date oldest to newest, then newest to oldest. I have swapped out the order by in the SQL below and I am not getting the result I was hoping for.

SELECT T1.EMP_NBR, T1.term_date, (SELECT COUNT(*)+1 FROM qry_all_term_dates WHERE T1.EMP_NBR = EMP_NBR AND t1.[term_date]<[term_date]) AS GrpSeq
FROM qry_all_term_dates AS T1
ORDER BY T1.EMP_NBR, T1.term_date DESC;

Exampe.PNG
 

plog

Banishment Pending
Local time
Yesterday, 19:08
Joined
May 11, 2011
Messages
11,645
Change the less than to greater than
 

xstine

New member
Local time
Yesterday, 19:08
Joined
Dec 31, 2019
Messages
5
Change the less than to greater than
durp, thank you so much. I have been working on this for too long and I think I was having a brain melt.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:08
Joined
May 7, 2009
Messages
19,231
you also need to change the Sort Order:

...
...
ORDER BY T1.EMP_NBR, T1.term_date
 

Users who are viewing this thread

Top Bottom