我有以下表格:如何根據另一個表中的數據對mysql中的項目進行排序?
WORD_LIST:
id | word
1 | ball
2 | car
3 | small
items_word_match:
itemid | wordid | in_title | in_description
1 | 1 | 1 | 0 //The word #1 occurs once in the title of the item
1 | 3 | 0 | 2 //The word #3 occurs twice in the title of the item
3 | 3 | 1 | 2
2 | 1 | 1 | 0
搜索:
wordid | importance
1 | 1
2 | 5
3 | 2 //word #3 is more important than the word #1 but less so than word #2
我想根據從關鍵字的項目進行排序搜索表以及關鍵字的重要性。
如果關鍵字在標題中的重要性應該增加1,如果出現2倍的單詞的重要性應該是重要的* 2
沒有爲*壞*英文道歉。只要我們知道你的意思**,這不是問題。而且你的英語除了**之外根本不好。 – Johan 2011-05-22 20:03:16