sql - MySQL group by without column name -
i have table contains user infos.
mysql> desc accounts; +-------------+------------+------+-----+---------+----------------+ | field | type | null | key | default | | +-------------+------------+------+-----+---------+----------------+ | cid | int(11) | no | pri | null | auto_increment | | username | text | yes | | null | | | password | text | yes | | null | | | mysignature | text | yes | | null | | | is_admin | varchar(5) | yes | | null | | +-------------+------------+------+-----+---------+----------------+ 5 rows in set (0.01 sec)
normal group statement follows 1 or more column names below:
select * accounts group cid;
just example, in general group by
works aggregate functions sum()
.
i have found follows expression without column names cant understand:
mysql> select username accounts group now(); +----------+ | username | +----------+ | admin | +----------+ 1 row in set (0.00 sec)
i new in mysql. how query work ? thanks.
in fact it's expression. compares expression results instead of column values grouping.
Comments
Post a Comment