我有兩個表(_video,_video_tag)像這樣。mysql搜索查詢一對多表
我如何構建一個最佳搜索查詢?
我想在這個領域(標題,描述,標籤)
mysql> describe _video;
+-------------+---------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+-------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(11) | NO | MUL | NULL | |
| image | varchar(255) | NO | | NULL | |
| source | varchar(255) | YES | | NULL | |
| duration | int(11) | NO | | NULL | |
| title | varchar(255) | NO | | NULL | |
| slug | varchar(255) | NO | | NULL | |
| description | text | NO | | NULL | |
| order | int(11) | NO | | 0 | |
| hit | int(11) | NO | | 1 | |
| status | enum('0','1') | NO | | 1 | |
| date_add | timestamp | NO | | CURRENT_TIMESTAMP | |
+-------------+---------------+------+-----+-------------------+----------------+
mysql> select * from _video_tag limit 5;
+----------+------------------------------------+
| video_id | tag |
+----------+------------------------------------+
| 17748 | cevahir almanca dersi |
| 17748 | genis aile |
| 17748 | ulvi |
| 17748 | cevahir |
| 17749 | oyle bir geçer zamanki
+----------+------------------------------------+
我也搜索標題和說明。您的查詢只在標籤中搜索 – alioygur