select * from tb t where id=(select min(id) from tb where 序号=t.序号)
求解这句SQL用的是什么语法,之前学的知识里没有学到过
尤其是红字“t”是什么意思,用的是什么知识

解决方案 »

  1.   

    序号=t.序号用来表示每个序号取最小id
      

  2.   


    你可以查查联机丛书。
    给你举个例:select *from tbl as(可省略) a(给表tbl取的别名) inner join table as b on a.id=b.id
    这个能看明白么?
      

  3.   

    --绰号--
    select id as 序号,name 姓名 from t1
    --as可有可无
      

  4.   

    很简单,就是别名
    就好比,假如你的表名是peopleheadeyesfoothandbodyhatcatdog这么长,如果后面条件里用到就会
    peopleheadeyesfoothandbodyhatcatdog.id这样很麻烦,于是就弄了个别名,比如别名是pd,直接就pd.id就OK了
    =========================
    哥已经回帖了,你可别嫁给我…………
      

  5.   

    ---给tb表取别名t,where是一个子查询
    select * from tb t where id=(select min(id) from tb where 序号=t.序号)