如何获取列类型整数的最大值,该整数作为类型文本存储在sqlite表中 [英] How to get max value of column type integer stored as type text in sqlite table
本文介绍了如何获取列类型整数的最大值,该整数作为类型文本存储在sqlite表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在sqlite表中获得一列的MAX值. 问题是数据类型实际上很长,但是以文本形式存储在表中.我该如何处理这种奇怪的情况. 我已经在下面尝试过了,但这是不正确的
I want to get MAX value of one column in sqlite table. The problem is the type of data is long in fact but stored as text in the table.How can I do with this strange situation. I've tried of this below but it's not correct
SELECT MAX(ColumnName) FROM TABLE;
但是它返回的值却不正确!请有人可以帮助我
But it returned value but not correct!Please someone can help me
推荐答案
您总是可以将文本转换为整数:
you could always cast the text to an int:
SELECT MAX(CAST(ColunmName) as int) from TABLE
这篇关于如何获取列类型整数的最大值,该整数作为类型文本存储在sqlite表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文