我正在阅读工作中的一些旧代码,并注意到有几个带有order by 1
子句的视图。这有什么作用呢?
例子:
Create view v_payment_summary AS
SELECT A.PAYMENT_DATE,
(SELECT SUM(paymentamount)
FROM payment B
WHERE PAYMENT_DATE = B.PAYMENT_DATE
and SOME CONDITION) AS SUM_X,
(SELECT SUM(paymentamount)
FROM payment B
WHERE PAYMENT_DATE = B.PAYMENT_DATE
and SOME OTHER CONDITION) AS SUM_Y
FROM payment A
ORDER BY 1;