MySQL (simplified tables)
table_1
+----+-------+
| id | title |
+----+-------+
| 1 | test |
+----+-------+
| 2 | test |
+----+-------+
| 3 | test |
+----+-------+
table_2
+----+
| id |
+----+
| 1 |
+----+
table_3
+----+
| id |
+----+
| 1 |
+----+
| 3 |
+----+
PHP
$a = mysql_query("SELECT t1.id FROM table_1 AS t1 WHERE MATCH(t1.title) AGAINST ('test' IN BOOLEAN MODE)");
What I want to do now is:
a) If the id is included in table_2 OR table_3 it should be ranked higher than if it’s only present in table_1
b) If the id is included in table_2 AND table_3 it should be ranked even higher
So, the output should be:
1, 3, 2
1 Answer