请帮我写Sql Query .. [英] Pls help me for writing Sql Query ..

查看:76
本文介绍了请帮我写Sql Query ..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向所有程序员问好.
我需要您的帮助来编写SQL查询..
我正在建立一个员工数据库,我想在其中存储Emp_Id列,其值像这样的"E000001",因此请帮助我如何编写Sql查询以选择此格式的下一个ID.
在此先感谢..

hi to all programmer.
i need ur help for writing sql query ..
I m building a employee database in Which i want to Store Emp_Id coloumn with value like this"E000001" so pls help how i can write Sql query to to select select next Id in this Format..
thanks in advance..

推荐答案

你好安什,

有两种方法可以做到这一点,或者您可以有一个单独的表,在其中可以定义这种情况,例如为员工"E000001"购买"PO00001"的情况

或者,您也可以使用直接的方式,例如从表employee中选择最大值,然后将结果子字符串添加到数字部分,然后再加1,然后再次合并,并检查其第一个值是否用"E000001"硬编码.

希望对您有帮助

谢谢
sanjeev
Hello Ansh,

there is two approach to making this either you can have a seperate table in which you can define these case like for Employee "E000001" for purchase "PO00001"

Or you can have direct way like select max value from table employee substring the result and add 1 to numeric part and then combine again and ofcource check if its first value the hard code it with "E000001".

hoping this will help you

thanks
sanjeev


您好,请参见本文

单击此处 [
hello for substring please read this article

Click Here[^]


这篇关于请帮我写Sql Query ..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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