已知:news(新闻表) newsclass(新闻类别表)
news: id,title,date,classid
newsclass: classid,subclassname现要查出news表中 各个类别的前三条记录 
并取出各个类别的名字这是自己写的  mysql的in不支持limit
select a.id,a.title,a.date,b.subclassname from 
news as a,newsclass as b 
where a.classid = b.classid and b.classid 
in (select classid from news limit 0,3) 请问各位:如何实现

解决方案 »

  1.   

    LZ的想法和语句完全不符合啊。
    不过单纯LZ的语句得分两句才行create temporary table tmp select classid from news limit 3;select a.id,a.title,a.date,b.subclassname from  
    news as a,newsclass as b  
    where a.classid = b.classid and b.classid  
    in (select classid from tmp);
      

  2.   

    骑着上帝看戏
    ---------------
    我发现就几个人,
    在mysql 里
      

  3.   

    你先select count(1) from tmp;看看有没有结果?