This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / sql 语句中对一个参数想用2个函数,比如我想要 count( distinct( aaa) ),这个如何写啊?
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1727852@0)
-
^
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1728243@0)
-
select count(distinct(cFieldname)) from cTableName, you got it, that's it. Or using 'Group By' instead of distinct.
-mcsdocp(OMR);
2004-5-18
(#1728281@0)
-
count(distinct(aaa)) 方法是语法错误,用group by,我也实在想不出来,如何group
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1728308@0)
-
语法错误? Impossible! Try again.
-mcsdocp(OMR);
2004-5-18
(#1728343@0)
-
呵呵,我用的是informix,可能不太一样,所以我想找一种‘普通’的方法来做到这点,刚才试了一下,ms-sql里面count(distinct(aaa))确实可以通过
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1728402@0)
-
1. select count(distinct(FieldName)) from TableName;
2. select count(*) from (
select FieldName, count(*) from TableName
group by FieldName);
-david_73(大卫);
2004-5-18
(#1728394@0)
-
方法2,informix认为括号内逗号处有语法错误,ms-sql认为‘)’处有语法错误
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1728420@0)
-
should be select count (distinct aaa) from tablename
-guestagain(guest again);
2004-5-18
(#1728495@0)
-
真正高手啊!!!!虽然就是一个括号的区别,但ms-sql和informix都能通过这语句,谢谢了!!! 你好像懂很多东西啊:)
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1728535@0)
-
Thanks to everyone.
-oceandeep(北极熊·湖州粽子);
2004-5-18
(#1728536@0)