Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从mysql表中选择行的计数时间?_Mysql_Count - Fatal编程技术网

从mysql表中选择行的计数时间?

从mysql表中选择行的计数时间?,mysql,count,Mysql,Count,我有一个基本的博客MySql表: CREATE TABLE IF NOT EXISTS `blogs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `blogText` text NOT NULL, `allowcomment` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) 创建表(如果不存在)`blogs`( `id`int(11)非空自动增量, `blogText`文本不为空, `allowco

我有一个基本的博客MySql表:

CREATE TABLE IF NOT EXISTS `blogs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `blogText` text NOT NULL, `allowcomment` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) 创建表(如果不存在)`blogs`( `id`int(11)非空自动增量, `blogText`文本不为空, `allowcomment`tinyint(1)不为空, 主键(`id`) ) 我想记录查询每行的次数。基本上保持着视线的轨迹。我真的不想创建一个表来跟踪IP地址,并插入一个IP地址和blogs.id作为唯一的密钥。然后计算该表中唯一键的数量


我希望尽可能的高效和准确

您需要创建一个新表或列以保持计数。并使用
触发器
在每次选择查询后更新计数。我想这就是方法。

基本上,你不能计算一行被选中的次数,除非你创建一个表或列来保持计数,然后自己编写代码来更新计数器。。。