当前位置:网站首页>PgSQL converts string to double type (to_number())
PgSQL converts string to double type (to_number())
2022-07-03 07:22:00 【Maple Leaf pear flower】
Today I write sql When , Find out PG There is a table in which the area field is set to string type , In this way, statistics cannot be used sum Function , So you need to convert the string to double Add the types .
select sum(to_number(mj,9999.99)) as amountmj from table group by area
among 9999.99 It doesn't matter mj The value of the field is still amountmj The value of cannot exceed 9999.99, And keep two decimal places .
边栏推荐
猜你喜欢
随机推荐
Use of framework
TCP cumulative acknowledgement and window value update
TreeMap
gstreamer ffmpeg avdec解码数据流向分析
The underlying mechanism of advertising on websites
Deep learning parameter initialization (I) Xavier initialization with code
When MySQL inserts Chinese into the database, there is a diamond question mark garbled code
twenty million two hundred and twenty thousand three hundred and nineteen
Win 2008 R2 crashed at the final installation stage
3311. 最长算术
Inno setup production and installation package
你开发数据API最快多长时间?我1分钟就足够了
Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
Laravel Web Framework
4everland: the Web3 Developer Center on IPFs has deployed more than 30000 dapps!
Advanced API (use of file class)
2021-07-18
Common architectures of IO streams
VMware virtual machine installation