Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法通过 2 列或更多列的总和来对查询进行排序?我想根据一些行的总和来做一个顶部[数字]
select num1, num2 from mytable order by num1+num2 desc
SELECT Col1, Col2,...,Coln FROM table ORDER BY Col1+Col2+...+Coln DESC
根据您的服务器,您可能无法在 ORDER BY 中使用表达式。您可能还需要在 SELECT 列表中包含该排序列。