Originally my idea is to use PHP for the loop to execute the SQL statements more than once, but later a thought, doing so in the data is not much good, if more data, query so many times do not know how much resources to consume.
After trying to break the scalp, I finally found the solution. Use the count () function and "<=" to count the numbers. The specific ideas are as follows, first query the row data's unique ID value with the SELECT statement, and then use the
The code is as follows |
Copy Code |
The select count (ID) from table where id<=xxx is counted. |
The SQL statement is probably like this:
SQL code
The code is as follows |
Copy Code |
Select COUNT (ID) from table where ID <= (select id from table where name = ' Ku_andrew ') |
Here specifically, this table must have an ID table segment, and the last row of the value is larger than the previous row.