g***o 发帖数: 297 | 1 Does anybody help me take a look of following SQL statement
select distinct count(column_name) from table name;
what I want is the unique count number for given column. but it returns
me all of the count ( not unique count).
This statement works fine against Oracle, but not for ACCESS.
thanks very much. |
g***o 发帖数: 297 | 2 finally got the answer.
MS ACCESS does not support SELECT COUNT(DISTINCT COLUMN_NAME ) FROM
TABLE_NAME,
but we can use subquery to get the DISTINCT COUNT NUMBER.
the query is
SELECT COUNT(column_name) FROM
(SELECT DISTINCT column_name FROM table_name).
【在 g***o 的大作中提到】 : Does anybody help me take a look of following SQL statement : select distinct count(column_name) from table name; : what I want is the unique count number for given column. but it returns : me all of the count ( not unique count). : This statement works fine against Oracle, but not for ACCESS. : thanks very much.
|
z****e 发帖数: 17 | 3 SELECT COUNT(column_name) FROM table_name GROUP BY column_name
Is it same?
【在 g***o 的大作中提到】 : finally got the answer. : MS ACCESS does not support SELECT COUNT(DISTINCT COLUMN_NAME ) FROM : TABLE_NAME, : but we can use subquery to get the DISTINCT COUNT NUMBER. : the query is : SELECT COUNT(column_name) FROM : (SELECT DISTINCT column_name FROM table_name).
|
g***o 发帖数: 297 | 4 I think these two queries get different recordsets.
for instance, we have following table
county company
2 A
3 A
4 A
2 B
3 B
4 B
5 B
2 C
your query get this result:
county count
2 3
3 2
4 2
5 1
my query get the result like:
count
4
the reason is that I get the count number of distinct county that exists in
this table,
while you get the count numb
【在 z****e 的大作中提到】 : SELECT COUNT(column_name) FROM table_name GROUP BY column_name : Is it same?
|