Traditional Culture Encyclopedia - The 24 Solar Terms - Sql queries the values for several months in a row.

Sql queries the values for several months in a row.

First, find the login month of each user by group, and use the ROW_NUMBER () function to give each user a sorted serial number. Then subtract the serial number from the user's login month. If the months are consecutive, the numbers subtracted are the same. So we can find consecutive months.