我有一张桌子,如下表
表1
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 [];
}
我想在搜索中显示带有关键字“发烧”的类型列表。 我想要从table1和table2输出如下
我该怎么做才能从另一个表中获取记录?