34,590
社区成员
发帖
与我相关
我的任务
分享
最好给出完整的表结构,测试数据,计算方法和正确结果.
select top 10
*
from [Company] c ,
info i with ( nolock )
where c.AuditState = 1
and c.userid in ( select i.userid
from company c ,
info i
where c.userid = i.userid
and c.UpdateTime > i.CreateTime )
order by case when c.[UserId] in ( select c.UserId
from Company c
where [SubDomain] <> ''
and [SubDomain] is not null )
then 1
else 2
end ,
c.CompanyId desc ;
select count(*)
from [Company] c with ( nolock )
where c.AuditState = 1
select
top 10 *
from [Company] c with (nolock) ,INFO I
where c.AuditState=1 and c.userid=i.userid and c.UpdateTime>i.CreateTime
order by
case when c.[UserId] in(select c.UserId from Company c where [SubDomain]<>'' and [SubDomain] is not null )
then 1 else 2 end ,c.CompanyId desc;select count(*) from [Company] c with (nolock) where c.AuditState=1
?select top 10 *
from [Company] c,info i
where c.AuditState=1
and c.userid=i.userid
and c.UpdateTime>i.CreateTime
order by case when c.[SubDomain]<>'' and c.[SubDomain] is not null then 1 else 2 end ,c.CompanyId desc