日期:2014-05-17 浏览次数:20478 次
create table CUST
(
no int,
com nvarchar(10)
)
go
create table LM
(
no int,
com nvarchar(10),
M_LINK nvarchar(10)
)
go
create table [LOG]
(
no int,
M_LINK nvarchar(10),
TIME datetime
)
go
insert into cust values(1,'公司A')
insert into cust values(2,'公司B')
insert into cust values(3,'公司C')
insert into lm values(1,'公司A','张1')
insert into lm values(1,'公司A','李2')
insert into lm values(1,'公司A','何3')
insert into lm values(2,'公司B','赵4')
insert into lm values(2,'公司B','王5')
insert into lm values(2,'公司B','钱6')
insert into lm values(3,'公司C','李7')
insert into [log] values(1,'张1','2013/09/12')
insert into [log] values(2,'李2','2013/10/12')
insert into [log] values(3,'李2','2013/10/12')
insert into [log] values(4,'赵4','2013/11/11')
insert into [log] values(5,'王5','2013/11/11')
insert into [log] values(6,'钱6','2013/08/03')
insert into [log] values(7,'李7','2013/11/11')
insert into [log] values(8,'张1','2013/09/11')
select b.com,b.m_link,max(c.time