有一张提问表  一张回答表 回答表每行数据都有问题的id  我现在要查询最新回答的问题 怎么结合查询
  求救

解决方案 »

  1.   

    select * from table order by time desc
      

  2.   

    将id指定为自增,然后select * from 问题表 where exists (select top 1 from 答案表 where 问题表.id = 答案表.id order by 答案表.id desc)
      

  3.   

    SELECT TOP 1 id from 表 order by 回答问题时间 desc
      

  4.   

    select * from 提问表 inner join (select 提问表.主键 as 提问表主键 max(回答时间) from 回答表 group by 提问表.主键) a1 on 提问表.主键= a1.提问表主键
      

  5.   

    我提问表的字段   id 标题  类别id  状态  是否后台审核通过  创建时间 提问内容 提问会员名
    我回答表的字段  id 问题对应id 回答内容 回答用户 回答时间 是否通过审核查询最新有人回答的问题
      

  6.   

    select distinct a.Id,a.标题
    from 提问表,a 回答表 b
    where a.Id=b.问题对应Id
    order by b.回答时间 desc;
      

  7.   

    纠正一下:select distinct a.Id,a.标题 
    from 提问表 a, 回答表 b 
    where a.Id=b.问题对应Id 
    order by b.回答时间 desc;