--生长发育表growth--
create table Growth(
Growth_Id integer primary key,     --发育表表单号
Growth_StuId integer,             --学员id
Growth_Stature number,            --身高
Growth_Sit number,               --坐高
Growth_Head number,               --头围
Growth_Circumference number,      --胸围
Growth_Avoirdupois number,        --体重
Growth_Eye number,                --视力
Growth_Time date,                  --测量时间
Re varchar2(50)               --备注
);--学生表--
stu_id integer,
stu_name varchar2(50)
--班级表--
class_id integer,
class_name varchar2(50)我想查询某一个班级里的所有学生的生长发育信息,
每个学生只显示一个记录,就是测量时间最后的一条.弄了一天还是没弄出来,用的是oracle数据库,请各位前辈帮帮忙!

解决方案 »

  1.   

    这里是mssql 专区。
    Oracle专区--》http://forum.csdn.net/BList/Oracle/
      

  2.   


    select * from 学生表 s left join Growth g on s.stu_id=g.Growth_StuId
    where Growth_Time=(select max(Growth_Time) from Growth where Growth_StuId=g.Growth_StuId )
      

  3.   

    发育表中还要有某个学生的班级号 class_idselect growth.*,student.*,class.*
    where growth.Growth_StuId=student.Growth_StuId AND growth.class_id
    group by class_id,growth.*,student.*,class.*
    having class_id='一个特定的class_id'