如何在 sql 视图中排序 [英] How to sort within a sql view
本文介绍了如何在 sql 视图中排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个 sql 视图,我需要在 4 个字段上使用 ORDER BY 对 select 的结果进行排序,但是我收到消息,除非我使用 TOP,否则无法在视图中使用 ORDER BY.有人可以解释为什么需要 TOP,有人有在 sql 视图中排序的解决方法吗?
I've created a sql view and I need to sort the results of select by using the ORDER BY on 4 fields, but I'm getting message that ORDER BY cannot be used in views unless I use TOP. Can someone explain why TOP is needed, and does someone have a workaround for sorting in a sql view?
谢谢.
推荐答案
您不需要对视图进行排序.视图就像一个表格,因此您可以在从中选择时对其进行排序:
you don't need to sort a view. a view is like a table so you sort it when you select from it:
select * from yourView order by yourColumns
这篇关于如何在 sql 视图中排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文