请问这个查询语句怎么写? 最好用存储过程 谢谢!
请问这个查询语句怎么写? 最好用存储过程 谢谢!一,关键词表:(keyword)
kid keywords
1 中国
2 美国
3 法国
(注 keywords是由 content split得来)
二,页面表 (page)
pid url content userid
1 http://www.hao123.com/index.html 该页面的文本内容 1
2 http://www.sina.com 该页面的文本内容 2
3 http://www.hao123.com/about.html 该页面的文本内容 1
4 http://www.163.com 该页面的文本内容 3
三,关键词分析表(fenxi)
id kid pid userid score
1 1 1 1 10
2 1 3 1 20
3 2 3 1 18
4 3 4 3 16
搜索数据的时候先到关键词表找到对应的关键词 然后到关键词分析表根据kid找到匹配的页面ID(即pid) 按照score从高到低排序 最后把页面表(即page表)的数据全部显示出来!(显示的时候按照userid分组) --------------------编程问答--------------------
--------------------编程问答-------------------- 楼上已经写了 --------------------编程问答--------------------
select *
from page
where pid in (
select pid
from fenxi
where kid in (
select kid
from keyword
where keywords=N'关键字')
order by score desc)
group gy userid
)
//try
up --------------------编程问答--------------------
--------------------编程问答--------------------
select *
from page
where pid in (
select pid
from fenxi
where kid in (
select kid
from keyword
where keywords=N'关键字'
)
order by score desc
)
group gy userid
//多加了个括号
up --------------------编程问答-------------------- 同一个问题问了好几次,
不知道lz想干什么。。。
--------------------编程问答-------------------- 哎,留给我的只能是 顶了。 --------------------编程问答-------------------- 顶。。。。。。 --------------------编程问答-------------------- 纠正个错误by 。。。 --------------------编程问答--------------------
本来想在重发一遍的,想想还是算了... --------------------编程问答-------------------- hehe
补充:.NET技术 , ASP.NET