2021年2月9日星期二

Can PostgreSQL use FOR LOOP in ORDER BY?

Can I make SQL statements like this?

    SELECT               ARRAY[array]      FROM   table1      ORDER BY          FOR i in array_length(array,1) LOOP                   array[i]::numeric              END LOOP;   

The result I want is:

SELECT          ARRAY[array]  FROM   table1  ORDER BY array[1]::numeric, array[2]::numeric, ...  

Can I? :)

https://stackoverflow.com/questions/66130990/can-postgresql-use-for-loop-in-order-by February 10, 2021 at 12:39PM

没有评论:

发表评论