34,590
社区成员
发帖
与我相关
我的任务
分享
select *
from TSoftware a
left join
(
select *
from TUpdateInfo t
where not exists (select 1 from TUpdateInfo where version = t.version and software_id = t.software_id and time > t.time)
)b
on a.software_id = b.software_id
select a.*,b.*
from TSoftware a
outer apply (
select top 1 *
from TUpdateInfo c
where a.software_id=b.software_id
order by time desc
) as b
select a.*,b.*
from TSoftware a
join TUpdateInfo b on a.software_id=b.software_id
where
not exists(select 1 from TSoftware where software_id=a.software_id and time>a.time)
and
not exists(select 1 from TUpdateInfo where software_id=b.software_id and time>b.time)