declare @zy as nvarchar(50)= N'美术'
declare @xl as nvarchar(50)=N'大专'
declare @nl as nvarchar(50)=N'20-30'
declare @jg as nvarchar(50)=N'北京';
with CTE1
as
(
select * from T2 where zy=@zy
union all
select * from T2 where xl=@xl
union all
select * from T2 where nl=@nl
union all
select * from T2 where jg=@jg
)
select ISNULL(num,0) as num,B.id,na,xb,zy,nl,jg,xl from (
(select COUNT(id) as num,id from CTE1
group by id) as A
right join T2 as B on A.id = B.id
)
order by num desc
num 值越大则匹配度越高
#9
考虑到分页的问题,感觉还是用 sql 做比较好。
1. 将所有过滤条件拆成单个,每一个条件都进行 select ,然后将结果集 union all
2. 对 1 中得到结果集根据 键值字段分组,并 count 键值字段,出现次数多的记录,匹配度自然高。
declare @zy as nvarchar(50)= N'美术'
declare @xl as nvarchar(50)=N'大专'
declare @nl as nvarchar(50)=N'20-30'
declare @jg as nvarchar(50)=N'北京';
with CTE1
as
(
select * from T2 where zy=@zy
union all
select * from T2 where xl=@xl
union all
select * from T2 where nl=@nl
union all
select * from T2 where jg=@jg
)
select ISNULL(num,0) as num,B.id,na,xb,zy,nl,jg,xl from (
(select COUNT(id) as num,id from CTE1
group by id) as A
right join T2 as B on A.id = B.id
)
order by num desc
num 值越大则匹配度越高
十分感谢,我试下
#1
adodb.recordset全部读取出来后GetRows转为数组自己就算匹配率,然后排序下输出
#2
adodb.recordset全部读取出来后GetRows转为数组自己就算匹配率,然后排序下输出
没太明白,能否详细说下?谢谢
#3
考虑到分页的问题,感觉还是用 sql 做比较好。
1. 将所有过滤条件拆成单个,每一个条件都进行 select ,然后将结果集 union all
2. 对 1 中得到结果集根据 键值字段分组,并 count 键值字段,出现次数多的记录,匹配度自然高。
#4
考虑到分页的问题,感觉还是用 sql 做比较好。
1. 将所有过滤条件拆成单个,每一个条件都进行 select ,然后将结果集 union all
2. 对 1 中得到结果集根据 键值字段分组,并 count 键值字段,出现次数多的记录,匹配度自然高。
能否把代码发一下??谢谢了
#5
还是不太明白该如何做。。。
#6
你说的匹配度是什么意思?
#7
你说的匹配度是什么意思?
我也想问这个。
#8
考虑到分页的问题,感觉还是用 sql 做比较好。
1. 将所有过滤条件拆成单个,每一个条件都进行 select ,然后将结果集 union all
2. 对 1 中得到结果集根据 键值字段分组,并 count 键值字段,出现次数多的记录,匹配度自然高。
declare @zy as nvarchar(50)= N'美术'
declare @xl as nvarchar(50)=N'大专'
declare @nl as nvarchar(50)=N'20-30'
declare @jg as nvarchar(50)=N'北京';
with CTE1
as
(
select * from T2 where zy=@zy
union all
select * from T2 where xl=@xl
union all
select * from T2 where nl=@nl
union all
select * from T2 where jg=@jg
)
select ISNULL(num,0) as num,B.id,na,xb,zy,nl,jg,xl from (
(select COUNT(id) as num,id from CTE1
group by id) as A
right join T2 as B on A.id = B.id
)
order by num desc
num 值越大则匹配度越高
#9
考虑到分页的问题,感觉还是用 sql 做比较好。
1. 将所有过滤条件拆成单个,每一个条件都进行 select ,然后将结果集 union all
2. 对 1 中得到结果集根据 键值字段分组,并 count 键值字段,出现次数多的记录,匹配度自然高。
declare @zy as nvarchar(50)= N'美术'
declare @xl as nvarchar(50)=N'大专'
declare @nl as nvarchar(50)=N'20-30'
declare @jg as nvarchar(50)=N'北京';
with CTE1
as
(
select * from T2 where zy=@zy
union all
select * from T2 where xl=@xl
union all
select * from T2 where nl=@nl
union all
select * from T2 where jg=@jg
)
select ISNULL(num,0) as num,B.id,na,xb,zy,nl,jg,xl from (
(select COUNT(id) as num,id from CTE1
group by id) as A
right join T2 as B on A.id = B.id
)
order by num desc