Postgresql directly generate a unique ID in the query results

It requires no sorting

SELECT (ROW_NUMBER () over ()) AS ID (1,100) from generate_series
. 1
sorted according to fields specified

the SELECT (ROW_NUMBER () over (the Order by xxx desc)) AS the above mentioned id, xxx from generate_series (1,100) AS xxx
---------------------
Author: kmblack1
Source: CSDN
original: https: //blog.csdn.net/kmblack1/article/details/79759995
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/telwanggs/p/11056476.html
Recommended