首先,对于这个论坛中是否有类似帖子,我深表歉意,请高手帮助我。 例如,我有一个具有下表的新闻站点门户:
+----+---------+----------------------+
| id | title | tags |
+----+---------+----------------------+
| 1 | news #1 | politic, movie, tech |
| 2 | news #2 | movie, tech, health |
| 3 | news #3 | health |
| 4 | news #4 | politic, health |
| 5 | news #5 | movie, tips |
+----+---------+----------------------+
我想从所选标签值中获取ID,标题和总数,例如,如果我对标签进行“政治性”排序,那么我将得到以下结果:
Sort by tags 'politic'. Count : 2
+----+---------+----------------------+
| id | title | tags |
+----+---------+----------------------+
| 1 | news #1 | politic, movie, tech |
| 4 | news #4 | politic, health |
+----+---------+----------------------+
或
按标签“电影”排序。数:3
+----+---------+----------------------+
| id | title | tags |
+----+---------+----------------------+
| 1 | news #1 | politic, movie, tech |
| 2 | news #2 | movie, tech, health |
| 5 | news #5 | movie, tips |
+----+---------+----------------------+
我在PDO语句中使用mysqli,能否获得查询示例以及带有count先生的PDO语句?