select 1 from table,不查询具体的列的内容,只要有值就显示为1.
实例:
mysql>create table t1(id int);
mysql>insert into t1 values(2);
mysql>insert into t1 values(3);
mysql>select * from t1;
+------+
| id |
+------+
| 2 |
| 3 |
+------+
2 rows in set (0.00 sec)
mysql>select 1 from t1;
+---+
| 1 |
+---+
| 1 |
| 1 |
+---+
2 rows in set (0.00 sec)
可以看到,不是具体的值,有值便显示为1,列名也显示为1.
阅读(791) | 评论(0) | 转发(0) |