易截截图软件、单文件、免安装、纯绿色、仅160KB

求一SQL - .NET技术 / C#

现有两个表

  表1 user (用户信息 )  

  username password  
  A 123  
  B 000
  C 555




表2 record (用户记录)
  id username logintime
  1 C 2009-10-10
  2 A 2009-10-11
  3 A 2009-10-12
  4 B 2009-10-13
  5 B 2009-10-15
  6 C 2009-10-16


表2 id列是自动编号,recordtime是最后登陆时间时间,现在要显示表1的所有信息 及最后记录时间,结果应该如下

username password logintime
A 123 2009-10-12
B 000 2009-10-15
C 555 2009-10-16

请问这条SQL语句如何写



   



我还在学,等我学会了教你啊,嘎嘎...

select username,password,(select top 1 logintime from record where record.username=[user].username order by logintime desc ) from [user] 


select a.*,b.lasttime from user as a 
left join
(select max(logintime)as lasttime,username from record group by username)
as b
on a.username = b.username

select t1.*,t2.lasttime from user t1 
left join
(select username,max(logintime)as lasttime from record g


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

请教SQL语句查询问题? - MS-SQL Server / 基础类

我想查询出每天数据的最大的一个值。表的格式如下
表名: hisdata
字段 编号 值 状态 时间  
  Id value state dattime  
  101 32.3 0 ......

c# Winform 触摸屏程序 - .NET技术 / C#

公司开发一个触摸屏程序,我负责的一块,实现这样一个功能,当鼠标点击窗口中图片(一张图分成几部分)的其中一部分时,将这部分图片截取出来,弹出新的窗口,将截取出的图片显示出来。我使用Rectange类控制了返回, ......

一条 SQL - Oracle / 基础和管理

有这样一条SQL
 Select Get_Costtaxrate(col1), Get_Tcostvalue(col1) from a
 
其中Get_Costtaxrate、Get_Tcostvalue都是函数,这两个函数里面都是查找一个大表,Get_Tcostvalue还需要调用Get_C ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号