(sql) how can I use count() method when data type is text?

后端 未结 3 1482
独厮守ぢ
独厮守ぢ 2021-01-16 22:35
select count(category) from list where category like \'action\'

above is a query i want to run. However, when I run that query, I am getting data

3条回答
  •  误落风尘
    2021-01-16 23:03

    You cant apply COUNT() function on text,ntext,image datatypes.

    Why you can't use :

    select count(*) from list where category like 'action'
    

    ? Do you have some nulls ?

    If you don't have to exclude null value the above query could already work well ...

提交回复
热议问题