语句是这样的
with cte as(select distinct top 10 QStandType.QStandTypeID,QStandType.QStandTypeName,ROW_NUMBER() over(order by QStandID asc) as num from QStand
inner join containstable(QStand,(QStandFRContent,QStandGRContent),'混凝土 and 强度',50)as k
on QStandID=k.[key]
inner join QStandType on
QStand.QStandTypeID=QStandType.QStandTypeID
order by QStandTypeID asc
)
select * from cte where num>5
declare @ContentOne nvarchar(50)
declare @ContentTwo nvarchar(50)
set @ContentOne='混凝土'
set @ContentTwo='强度'
declare @sql nvarchar(500)
set @sql='select distinct top 5 QStandType.QStandTypeID,QStandType.QStandTypeName from QStand
inner join
containstable(Qstand,([QStandFRContent],[QStandGRContent]),''("'+@ContentOne+'")and
("'+@ContentTwo+'")'',5000) as k
on QStandID=k.[key]
inner join QStandType on
QStand.QStandTypeID=QStandType.QStandTypeID
order by QStandTypeID'
exec sp_executesql @sql