如何从ms访问数据库中获取max substring值 [英] How to get max substring value from ms access database

查看:84
本文介绍了如何从ms访问数据库中获取max substring值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好每一个我都是ms访​​问数据库的新手我想从我的记录栏中获取最大子字符串编号,如001-001,001-002,001-003,002-001,002-002
。第一个001和002是父代码,所以我想要父代码为001的最大数字...

并且应该是001-003 ....

这里是我的qury ..





从[table]中选择max(substring(titleid,4,3)),其中parentis ='001 '





请帮助我,如果有的话可以。

i将会感谢全..



我尝试过的事情:



你好每一个我都是新手在ms访问数据库中我想从我的记录列中获取最大子字符串编号,如001-001,001-002,001-003,002-001,002-002

。第一个001和002是父代码,所以我想要父代码为001的最大数字...

并且应该是001-003 ....

这里是我的qury ..





从[table]中选择max(substring(titleid,4,3)),其中parentis ='001 '





请帮助我,如果有的话可以。

i将会感谢全..

hello every one i am new in ms access data base i want to get max sub string number from column my records like this 001-001, 001-002 , 001-003 , 002-001 , 002-002
. first 001 and 002 is parent code so i want max number where parent code is 001 ...
and should be 001-003 ....
here is my qury ..
.
.
"select max(substring(titleid,4,3))from[table] where parentis= '001'"
.
.
please help my if any one can.
i will be thank full..

What I have tried:

hello every one i am new in ms access data base i want to get max sub string number from column my records like this 001-001, 001-002 , 001-003 , 002-001 , 002-002
. first 001 and 002 is parent code so i want max number where parent code is 001 ...
and should be 001-003 ....
here is my qury ..
.
.
"select max(substring(titleid,4,3))from[table] where parentis= '001'"
.
.
please help my if any one can.
i will be thank full..

推荐答案

Max是一个数字函数,因此您需要先将字符串转换为数字。



我相信评估是val()函数



即max(val(substring(titleid,4,3)))
Max is a numeric function so you will need to convert the string to numeric first.

I believe assess is val() function

ie max(val(substring(titleid,4,3)))


这篇关于如何从ms访问数据库中获取max substring值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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