Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate Chinese digits from given numbers by MySQL

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to generate Chinese numbers with a given number by MySQL". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to achieve a given number to generate Chinese numbers" bar!

Using MySQL to realize

Select group_concat (target order by id desc Separator'') result from (

Select

Concat (

Case s

When 0 then if (@ lastrowrights zero,'')

When 1 then 'one'

When 2 then 'two'

When 3 then 'three'

When 4 then 'four'

When 5 then 'five'

When 6 then 'six'

When 7 then 'seven'

When 8 then 'eight'

When 9 then 'nine'

End

Case (id-1) mod 4 when 0 then''

When 1 then if (ten','')

When 2 then if ('hundred','')

When 3 then if ('thousand','')

End

Case ((id-1) / 4) when 1 then

When 2 then 'billion'

Else''

End

) target

@ lastrow:=s

A. *

From (

Select var.n,nums.id,substring (var.n,length (var.n)-id+1,1) s from (

Select 30150000 n writing lastroww is null.

) var, nums where length (var.n) > = nums.id

) a

) b

At this point, I believe you have a deeper understanding of "how to achieve a given number in MySQL to generate Chinese numbers". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report