У меня есть таблица как показано ниже
table1
id type
1 Aches, Pain, Fever
2 Fever
3 Fever Blisters
4 Hay Fever
5 Typhoid Fever
6 Valley Fever
7 Viral Hemorrhagic Fever
8 Yellow Fever
9 Fever with chills
10 Fever well
11 Day fever
12 Fever from week
13 Dengue Fever
14 Fever with cold
15 Fever with chills One
16 Fever hi
17 high grade fever
table2
id type
1 Acute Valley Fever
2 Allergic Rhinitis (Hay Fever)
3 Breakbone Fever
4 Coccidioidomycosis (Valley Fever)
5 Typhoid2 Fever
6 Valleyrt Fever
Я пытаюсь это с php codeigniter
$this->db->select("id,type");
$this->db->from('table1');
$this->db->like('type', $searchterm, 'after');
$query1 = $this->db->get_compiled_select();
$this->db->select("id,type");
$this->db->from('table1');
$this->db->like('type', $searchterm, 'both');
$this->db->not_like('type', $searchterm, 'after');
$query2 = $this->db->get_compiled_select();
$searchResult = $this->db->query($query1 . " UNION " . $query2)->result();
if (sizeof($searchResult) > 0) {
return $searchResult;
} else {
return [];
}
Я хочу показать список типов при поиске с ключевым словом «лихорадка».Я хочу вывод из таблиц1 и таблиц2, как показано ниже
- сначала показывают типы, которые начинаются с ключевого слова «лихорадка»
- , а затем показывают типы, которые содержат ключевое слово «лихорадка» в качестве подстроки
Что я могу сделать, чтобы получить записи из другой таблицы?