[转载]查询之order by,group by和having的使用(三)
六、例子
1> select * from bank_info
2> go
(2 rows affected)
1> select * from bank_info where acctround='1' group
by bankno order by bankno
2> go
(2 rows affected)
1> select * from bank_info where acctround='1' order
by bankno
2> go
(1 row affected)
1> select * from bank_info
2> go
(2 rows affected)
1> select * from bank_info where acctround='1' group
by bankno,acctround order by bankno
2> go
(1 row affected)
group by bankno,acctround
或者是:
select bankno,sum(money) from bankdiff group by bankno;
又或者是:
select bankno,acctround,sum(money) from bankdiff where
acctround='1' group by bankno,acctround;
不可能指定acctround又不把它放在groub by中的.
1> select * from bank_info group by bankno
2> go