在VARCHAR字段中使用MAX() [英] Using MAX() in VARCHAR Field

查看:156
本文介绍了在VARCHAR字段中使用MAX()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张包含以下数据集的表

I have a table with following set of data

ID (VARCHAR2 field)
D001
D002
D010
D0012

我在此字段中使用max().

Select max(ID) from <table-name>;

它返回D010作为结果.

为什么结果不是D0012?

推荐答案

之所以得到D010是因为按字母顺序,D010D0012之后,或者换句话说,D01D00之后,因此D01x是在D00x开始的任何事物之后出现的.

You get D010 because alphabetically, D010 comes after D0012 or said another way, D01 comes after D00 and therefore anything that is D01x comes after anything that starts D00x.

这篇关于在VARCHAR字段中使用MAX()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆