当前位置:首页 » 多媒体相关

**************sql问题******************简单的,大家帮忙


我有两个表,字段如下:      
  id             name             sex             birthday          
  001         张三             男                 1976-09-15      
  002         李四             男                 1978-05-15      
     
     
  autoid                 id                 date                             area      
  1                                     001             1980-76-09     15      
  2                                     001             1990-01-01     20      
     
  其中表二中的id和表一中的id关联,date字段是一个逐年增大的字段,我如何得到表一中的一行关联表二中date字段年份最大的一行,如:      
  id         name         sex         birthday             date                             area      
  001     张三         男             1976-09-15     1990-01-01     20          
     
  高手给个sql查询语句      
  我在paradox下,      
  select     top     1     test.id,     test1.dt     from     test,     test1     where     test1.id     =     0001     and     test.id     =     test1.id     order     by     test1.dt     desc      
     
  报错,不认     top     1      
  如何实现??????      
     
  select     test.id,     test1.dt     from     test,     test1     where     test1.id     =     0001     and     test.id     =     test1.id     order     by     test1.dt     desc      
  不报错,但不是我要得结果

推荐阅读

  • Adobe赢得成都反盗版案 盗版软件市值千万元 [详细内容]
  • Delphi面向对象编程的20条规则 [详细内容]
  • S689说明篇(一) [详细内容]
  • 专家:德州仪器车载RFID系统有严重安全漏洞 [详细内容]
  • JBuilder7+Delphi6写CORBA体验 [详细内容]
  • S689说明篇(二) [详细内容]
  • IE浏览器中出现的新漏洞可使黑客以假换真 [详细内容]
  • 网友回答:
    网友:zhymax

    试试下面的语句  
      select     test.id,     max(test1.dt)      
      from     test   inner   join   test1   on   test.id   =   test1.id      
      where     test1.id     =     0001      
      group   by     test.id        
     

    .

    讨论区

    Login