如何从两个表中查数据并分页呢?select a.card b.name form meng a, neng b where a.card=b.card分页咋写呢??????

解决方案 »

  1.   


    sql 数据库 2005 或者2000
      

  2.   

    sqlserver 不就是用 top吗百度 sqlserver 分页sql
      

  3.   

    select top 10 * from table 取前十行
      

  4.   

    select top 10 * from (select a.card b.name form meng a, neng b where a.card=b.card)
      

  5.   


    不明白?
    检索数据(仅ID)后使用
    ResultSet.absolute(xxx);
      

  6.   

    这里不得不说一个功能强大的数据库软件postgresql,它的分页太牛B了,不需要指针。
    只需要这样SELECT * FROM table_name ORDER BY field_name LIMIT 10 OFFSET 10;
    他的意思就是忽略掉前10条再取10条,如果你是第3页就是忽略掉前20条再取10条。
    看我的自己做的手机留言网站就是用这个数据库实现的分页
    手机留言网站:一言一语点击进入(帮我留言哈)
      

  7.   

    select top 10 a.id 
    from a left join b on a.id=b.id 
    where a.id not in(select top 10 a.id 
    from a);第二个top 10 就是你传进来的值:每页显示的数据条数 * 页数
      

  8.   

    http://www.cnblogs.com/anjou/archive/2007/10/17/926944.html
    这里有,但感觉没有mysql oracel那么方便~
      

  9.   


    select card,name from(
    select rownum rowCount,a.card,b.name from meng a,neng b where a.card=b.card and rownum<10) where row Count>1
      

  10.   

    别人用得是sqlserver2005 or 2000,你这是oracle得语法
      

  11.   


    a left join b   什么意思?
      

  12.   

    oracle 或者Sqlserver2005以上,都可以使用ronum这个函数了,至于sqlserver2000么,好久不用,以前用的是 not in做的,楼上的说法基本都能实现分页,但是利用rownum更好一些,毕竟比起not in来还是方便高效一些的了