(sql) 当数据类型为文本时,如何使用 count() 方法? [英] (sql) how can I use count() method when data type is text?
本文介绍了(sql) 当数据类型为文本时,如何使用 count() 方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
select count(category) from list where category like 'action'
上面是我想运行的查询.但是,当我运行该查询时,我得到数据类型错误.count()
有什么替代方法吗?或者...我如何使用 count()
方法
当数据类型为文本时?
above is a query i want to run. However, when I run that query, I am getting
data type error.
is there any alternative method for count()
? or... how can I use count()
method
when data type is text?
推荐答案
你不能在 text、ntext、image 数据类型上应用 COUNT() 函数.
You cant apply COUNT() function on text,ntext,image datatypes.
为什么不能使用:
select count(*) from list where category like 'action'
?你有一些空值吗?
如果您不必排除空值,则上述查询可能已经运行良好...
If you don't have to exclude null value the above query could already work well ...
这篇关于(sql) 当数据类型为文本时,如何使用 count() 方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文