ALTER PROCEDURE dbo.get_all_digg_articles  select AllRssArticles.*, (select this_title from RssChannels where this_id=AllRssArticles.this_channel_id) as this_channel_title
from AllDiggArticles, AllRssArticles where AllDiggArticles.this_article_id=AllRssArticles.this_id问题是这样,在表AllRssArticles中有一个字段是ntext类型的,在所有表AllDiggArticles中会有重复的this_article_id的值,原则上是 应该用distinct AllRssArticles.id,可是由于表中含有ntext类型的字段,distinct不能用。求用什么办法能实现我的目的。

解决方案 »

  1.   

    select AllRssArticles.*, (select this_title from RssChannels where this_id=AllRssArticles.this_channel_id) as this_channel_title
    from AllDiggArticles, AllRssArticles where AllDiggArticles.this_article_id=AllRssArticles.this_id
    改为:
    select a.* ,c.this_title 
    from AllRssArticles a 
    right join AllDiggArticles b on a.this_id = b.this_article_id
    inner join RssChannels c on c.this_id = a.this_id
      

  2.   

    用convert把那ntext字段换成varchar(8000)
      

  3.   

    用convert把那ntext字段换成varchar(8000)