select A.书名,A.出版社,A.作者,B.maxdate as 借用日期 ,B.借用人
from 书 A inner join (
select max(借用日期) as maxdate,书名,借用人 from 记录 group by 书名) B
on A.书名=B.书名
from 书 A inner join (
select max(借用日期) as maxdate,书名,借用人 from 记录 group by 书名) B
on A.书名=B.书名
from 书 a,记录 b
where a.书名=b.书名
and not exists(
select * from 记录 where 书名=b.书名 and 借用日期>b.借用日期)
Select A.书名,A.出版社,A.作者,C.借用日期,C.借用人
from 书 A
Left Join
(Select * from 记录 B Where Not Exists(Select * from 记录 Where 书名=B.书名 And 借用日期>B.借用日期)) C
On A.书名=C.书名
Order By A.编号
from 书 A inner join (
select max(借用日期) as maxdate,书名 from 记录 group by 书名) B on A.书名=B.书名
inner join 记录 C on B.书名=C.书名 and B.借用日期=C.借用日期
那是存上时间不就可以了