I have a table with these rows:
City | Day
NEWYORK | MON
NEWYORK | MON
NEWYORK | MON
NEWYORK | TUE
CHICAGO | MON
CHICAGO | MON
I need to write a query to add column Occurrence
to the result using data from Columns City
and Day
:
City | Day | Occurrence
NEWYORK | MON | 1
NEWYORK | MON | 2
NEWYORK | MON | 3
NEWYORK | TUE | 1
CHICAGO | MON | 1
CHICAGO | MON | 2
EG: For NEWYORK
if MON
occurs 1st then Occurrence
=1, if MON
occurs twice then corresponding Occurrence
=2 and so on.