不一样的,例如:
SQL> select count(*) from testdb where id=1 group by name; COUNT(*)
----------
1
SQL> select count(decode(id,1,'*')) from testdb group by name;COUNT(DECODE(ID,1,'*'))
-----------------------
0
1
SQL> select count(*) from testdb where id=1 group by name; COUNT(*)
----------
1
SQL> select count(decode(id,1,'*')) from testdb group by name;COUNT(DECODE(ID,1,'*'))
-----------------------
0
1
select count(*) from ods.t_test where id=1
---
COUNT(*)
1select count(decode(id,1,'*')) from ods.t_test
---
COUNT(DECODE(ID,1,'*'))
1
但是decode(id,1,'*')中再加参数就会全部统计了
所以不一定要用'*',其他字符都行.
---------- ------------------------------
1 张三
2 李四SQL> select count(*) from a group by id; COUNT(*)
----------
1
1SQL> select count(decode(id,'1','x')) from a group by id;COUNT(DECODE(ID,'1','X'))
-------------------------
1
0
那么两种情况不一样结果