select count(1) from table1 这句话count里有个1是什么意思?

musicsoul 2004-03-24 10:36:14
select count(1) from table1 这句话count里有个1是什么意思?

谢谢!!!
...全文
229 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
cantops 2004-04-04
  • 打赏
  • 举报
回复
学到了。 开心中
htdqy 2004-03-30
  • 打赏
  • 举报
回复
牛人真多啊~
shuixin13 2004-03-30
  • 打赏
  • 举报
回复
呵呵,
是的.

就好像分组后 COUNT(*) = COUNT(Col1) 一样.
参数已没有什么实际意义了.
loveflea 2004-03-30
  • 打赏
  • 举报
回复
倏然我知道是表的第一列..但感觉用什么数字效果都是一样的!嗬嗬!

mysql> desc logoff;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| usernumber | varchar(15) | YES | MUL | NULL | |
+------------+-------------+------+-----+---------+-------+
1 row in set (0.41 sec)

mysql> select count(1) from logoff;
+----------+
| count(1) |
+----------+
| 1461742 |
+----------+
1 row in set (0.03 sec)

mysql> select count(1000) from logoff;
+-------------+
| count(1000) |
+-------------+
| 1461742 |
+-------------+
1 row in set (0.00 sec)

mysql> select count(0) from logoff;
+----------+
| count(0) |
+----------+
| 1461742 |
+----------+
1 row in set (0.00 sec)

mysql> select count(-1) from logoff;
+-----------+
| count(-1) |
+-----------+
| 1461742 |
+-----------+
1 row in set (0.00 sec)
lxf_1976 2004-03-26
  • 打赏
  • 举报
回复
*^_^*

一直都不知道!

学习!!!!
fish21cn 2004-03-26
  • 打赏
  • 举报
回复
哦。又学到了。
lehool 2004-03-25
  • 打赏
  • 举报
回复
CREATE TABLE `table1` (
`a` mediumint(4) NOT NULL auto_increment,
`b` varchar(20) NOT NULL default '',
`c` varchar(20) NOT NULL default '',
`d` tinyint(2) NOT NULL default '1',
`e` varchar(50) default NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `a` (`a`)
) TYPE=MyISAM

select count(1) from table1 == select count(a) from table1 !!
shuixin13 2004-03-24
  • 打赏
  • 举报
回复
表的第一列..

就好像

SELECT ... FORM ... ORDER BY 1 DESC;

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧