结果会是什么? [英] What will be the result ?
本文介绍了结果会是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SELECT TOP 1 * FROM table_Name ORDER BY unique_column DESC
会有什么结果:
- 最后插入一个或
- 第一个?
我需要最后插入的CustomerID。
解决方案
查询解释了自己,它返回table_Name
的整个顶行,按unique_column排序,降序
。这样,您将获得具有最大值unique_column
的行。如果您逐步插入unique_column
,是
,您将获得最后一个插入的。
出于好奇,为什么不尝试呢?
最后插入一个将是你的输出
< blockquote>
检查这个...
订购者 [ ^ ]
希望这对您有所帮助。
干杯
SELECT TOP 1 * FROM table_Name ORDER BY unique_column DESC
What will be the result:
- last inserted one or
- first one ?
I need last inserted CustomerID.
解决方案
The query explains itself, it returns the whole top row oftable_Name
ordered, descending, byunique_column
. This way you'll get the row having the greatest value ofunique_column
. If you are insertingunique_column
incrementally then,yes
, you'll get the last inserted one.
Out of curiosity, why don't you try it?
last inserted one will be your output
Hi,
Check this...
Order By[^]
Hope this will help you.
Cheers
这篇关于结果会是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文