select title_news,boardtype,hits from news a join board b on a.boardid=b.boardid 
join topicnums c on a.boardid=c.boardid

解决方案 »

  1.   

    select news.title_news,
           board.boardtype,
           topicnums.hits
    from news
    join board on news.boardid=board.boardid
    join topicnums on topicnums.boardid=board.boardid
      

  2.   

    select news.title_news,
           board.boardtype,
           topicnums.hits
    from news
    join board on news.boardid=board.boardid
    join topicnums on topicnums.boardid=board.boardid
      

  3.   

    join是什么意思?
    而且得出的结果不对
      

  4.   


    create table news(newsid int identity(1,1) not null,boardid int,title_news char(20))
    create table board(boardid int not null,boardtype char(20))
    create table topicnums(topicid int identity(1,1) not null,title_topicnums char(20),boardid int,hits int)insert into news
    select '22','aaaaa'insert into board
    select '22','时事新闻'insert into topicnums
    select 'aaaaa',22,90select b.title_news,a.boardtype,c.hits from board a
    join news b on a.boardid=b.boardid
    join topicnums c on a.boardid=c.boardid
      

  5.   

    join就是内连接,楼上几位的结果肯定是对的啦
      

  6.   

    inner join 内连接
    outer join 外连接
    nature join 自然连接这个问题的最简单形式:select title_news,boardtype,hits
    from 新闻表,新闻类表,点击记数表
    where 新闻表.boardid=新闻类表.boardid 
          and title_topicnums=title_news
      
    用连接似乎没有必要,你写的sql到了解释器后会自动的优化。
      

  7.   

    select c.title_topicnums,b.boardtype,c.hits
    from news a,board b,topicnums c
    where a.boardid=b.boardid,b.boardid=c.boardid and a.title_news=c.title_topicnums
      

  8.   

    To: TaiJi1985(太极)
     
    这个说得好。