日期:2014-05-18  浏览次数:20483 次

谁会写此sql语句?
et_channel[新闻频道表] et_news[新闻内容]
   
pk channel_id[频道编号] mews_id[新闻编号]  
  title[标题]
channel_fid[父频道编号] title2[副标题]
title [频道标题] mark[标识]
mark[频道标识] keyword[关键字]
memo[备注] summary[简介]
status[状态] content[内容]
createtime[创建时间] other_url[其他连接]
channel_order{排序} editor[作者]
channel_image[频道图片]



需求: 取当前频道的新闻编号列表

------解决方案--------------------
SQL code
;with cte as(
select channel_id,news_id,channel_fid from et_channel
union all
select b.channel_id,b.news_id,b.channel_fid from cte a inner join et_channel b on a.channel_fid=b.channel_id
)select news_id from cte

------解决方案--------------------
没看明白这俩表要怎么关联