select top 12
y1.[id],y1.[title],y1.[author],y1.[source],y1.[abstract],y1.[cover],y1.[views],y1.[link]
,t1.[id] as sortid,t1.[sname],t1.[spy],t1.[itemid]
,h1.[id] as jc_sortid,h1.[sname] as jc_sname,h1.[itemid] as jc_itemid
from
[xbls_info_bs] g1
inner join [xbls_info] y1 on y1.[sortid] in (608686522) and y1.[fgroup] in (119)
inner join [xbls_sort] h1 on h1.[id]=y1.[sortid]
inner join [xbls_sort] t1 on t1.[id]=g1.[sort]
where g1.[laylst]=500236613
and h1.[status]=1
and t1.[status]=1
and t1.[itemid]=864155367
and y1.[status]=9 and y1.[id] not in (
select top 1
b.[id]
from
[xbls_info_bsi] a
inner join [xbls_info] b on b.[id]=a.[info] and b.[sortid] in (608686522) and b.[fgroup] in (119)
inner join [xbls_sort] c on c.[id]=b.[sortid]
inner join [xbls_sort] d on d.[id]=a.[sort]
where a.[laylst]=500236613
and b.[status]=9
and d.[status]=1
and d.[itemid]=864155367
and c.[status]=1
)
order by y1.[time] desc,y1.[id] desc