更新时间:2022-06-03 03:22:23
这可以通过使用内置的SQL函数来实现吗? ROW_NUMBER()?此函数只是为结果中的每一行生成行号。您可以按条件指定分区和顺序。
示例:
This can be achieved by using built in SQL function ?ROW_NUMBER()?. This function simply generates row number for each row in the result. You can specify the partition and order by criteria.
Example:
SELECT ROW_NUMBER()
OVER (ORDER BY EmployeeName) AS Row,
EmployeeId, EmployeeName, Salary
FROM Employees
从 row_number_to_sql_select.html [ ^ ]
说你有5个字段,例如field1,field2,.. field5,在表中,每个都取值1或0,数据库的返回值存储在
say you have 5 fields, e.g. field1, field2,.. field5, in the table, each takes the value of 1 or 0, and the return values from database is stored in
field1,