Hello, I have a table that has a value ID
and other values among which is nombre
.
###############
# ID # Nombre #
###############
# 4 # Juan #
###############
# 3 # Juan #
###############
# 2 # Juan #
###############
# 1 # Martin #
###############
# 0 # Juan #
###############
Is it possible through a MySql query to obtain the occurrences followed by the most recent name (in this case Juan)?
That is to say that from the most recent name entered in the table (in this case Juan
) its occurrences are counted until another value interrupts the count (in this case Martin
).
In the example table the returned value should be 3 because the last name entered in the table was John and had 3 occurrences before the name Martin appeared.