62,269
社区成员
发帖
与我相关
我的任务
分享set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
alter PROCEDURE [dbo].[bb]
as
--定义临时表
create table #t ( ids int)
begin
--开始 插入首页列表推荐
insert into #t
select companyid as id
from NT_Company_RecommendKeys
where datediff(d,getdate(),endtime)>=0
order by recommend desc
--再插入一次
insert into #t
select top 61 id
from Company
where
id not in(
select * from #t
) order by id desc
select Company.*
from Company right join #t
on Company.id=#t.ids
drop table #t
end
exec bb
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
alter PROCEDURE [dbo].[bb]
as
--定义临时表
create table #t (id int identity(1,1), ids int)
begin
--开始 插入首页列表推荐
insert into #t
select companyid as id
from NT_Company_RecommendKeys
where datediff(d,getdate(),endtime)>=0
order by recommend desc
--再插入一次
insert into #t
select top 61 id
from Company
where
id not in(
select * from #t
) order by id desc
select Company.*
from Company right join #t
on Company.id=#t.ids
order by t.id
drop table #t
end
exec bb