首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

深夜,还有人在吗

2012-03-03 
深夜求助,还有人在吗?请问这句那里出错了.selectContent,ChannelID,ClassID,Title,count(*)fromPE_Article

深夜求助,还有人在吗?
请问这句那里出错了.
select   Content,ChannelID,ClassID,Title,count(*)   from   PE_Article
group   by   Content,ChannelID,ClassID,Title
having   count(*)> =2   and   ChannelID= '1035 '

服务器:   消息   306,级别   16,状态   2,行   1
不能比较或排序   text、ntext   和   image   数据类型,除非使用   IS   NULL   或   LIKE   运算符。
服务器:   消息   306,级别   16,状态   1,行   1
不能比较或排序   text、ntext   和   image   数据类型,除非使用   IS   NULL   或   LIKE   运算符。
Content是ntext,我想把它显示出来.

[解决办法]
try:
select Content=isnull(Content, ' '),ChannelID,ClassID,Title,count(*) from PE_Article
group by isnull(Content, ' '),ChannelID,ClassID,Title
having count(*)> =2 and ChannelID= '1035 '
[解决办法]
select (select b.Content from PE_Article b where b.id=a.id) as Content,a.ChannelID,a.ClassID,a.Title,count(a.*) from PE_Article a
group by a.ChannelID,a.ClassID,a.Title
having count(a.*)> =2 and a.ChannelID= '1035 '

热点排行