私がやりたいのは、類似性/類似性によって質問を並べ替え、Result
テーブルからのポイントに基づいてテーブル から結果を取得することPoint
です。
例: query = 'ドイツの場所'
次のテーブルがあります。
テーブルの質問
+---------+-----------+---------------+---------------------------------+
| ques_id | question |
+---------+-----------+---------------+---------------------------------+
| 1 | Where is Germany located |
+---------+-----------+---------------+---------------------------------+
| 2 | where is Germany located on a map |
+---------+-----------+---------------+---------------------------------+
| 3 | where is Germany located in Europe |
+---------+-----------+---------------+---------------------------------+
表の結果
+---------+-----------+---------------+---------------------------------+
| resu_id | result |
+---------+-----------+---------------+---------------------------------+
| 1 | Germany is located in Europe |
+---------+-----------+---------------+---------------------------------+
| 2 | Northern hemisphere in Europe |
+---------+-----------+---------------+---------------------------------+
| 3 | between France & Poland |
+---------+-----------+---------------+---------------------------------+
| 4 | Germany is located in central Europe |
+---------+-----------+---------------+---------------------------------+
| 5 | South of Denmark |
+---------+-----------+---------------+---------------------------------+
| 6 | 52 degrees North, 13 degrees East |
+---------+-----------+---------------+---------------------------------+
| 7 | located on the continent of Europe |
+---------+-----------+---------------+---------------------------------+
テーブルポイント
+---------+-----------+-----------+-----------+
| pont_id | ques_id | resu_id | point |
+---------+-----------+-----------+-----------+
| 1 | 2 | 6 | 10 |
+---------+-----------+-----------+-----------+
| 2 | 1 | 1 | 8 |
+---------+-----------+-----------+-----------+
| 3 | 2 | 7 | 7 |
+---------+-----------+-----------+-----------+
| 4 | 3 | 5 | 9 |
+---------+-----------+-----------+-----------+
| 5 | 3 | 4 | 8 |
+---------+-----------+-----------+-----------+
| 6 | 1 | 7 | 10 |
+---------+-----------+-----------+-----------+
| 7 | 3 | 2 | 6 |
+---------+-----------+-----------+-----------+
| 8 | 2 | 3 | 4 |
+---------+-----------+-----------+-----------+
私がしようとしました
SELECT resu_id FROM `Point` WHERE ques_id is (**?**) ORDER BY `point`
期待される結果
+---------+-----------+-----------+--------------------------------------------+
| ques_id | resu_id | point | result |
+---------+-----------+-----------+--------------------------------------------+
| 1 | 7 | 10 | located on the continent of Europe |
+---------+-----------+-----------+--------------------------------------------+
| 1 | 1 | 8 | Germany is located in Europe |
+---------+-----------+-----------+--------------------------------------------+
| 2 | 6 | 10 | 52 degrees North, 13 degrees East |
+---------+-----------+-----------+--------------------------------------------+
| 2 | 7 | 7 | located on the continent of Europe |
+---------+-----------+-----------+--------------------------------------------+
| 2 | 3 | 4 | between France & Poland |
+---------+-----------+-----------+--------------------------------------------+
| 3 | 5 | 9 | South of Denmark |
+---------+-----------+-----------+--------------------------------------------+
| 3 | 4 | 8 | Germany is located in central Europe |
+---------+-----------+-----------+--------------------------------------------+
| 3 | 2 | 6 | Northern hemisphere in Europe |
+---------+-----------+-----------+--------------------------------------------+
質問を関連性でソートし、ポイント値に基づいてそれぞれの結果を表示します。
助けてくれてありがとう、私に厳しくしないでください:)