由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - help about SQL for ACCESS
相关主题
SQL combine two tables into one table and add a new column服了,这就是我们QA和DBA的水平
SQL find distinct values in large table一个single table 的 SQL QUERY
SQL combine two columns from two different tables no shared (转载)SQL求助
新手问个简单的SELECT问题请教SQL server的一个programming的问题,谢谢
ask for help with a simple query!!!compare two large tables SQL (转载)
SQL select one value column for each distinct value another (转载)请帮我看看,什么地方错了?
help neededPIVOT TABLE
请教ssisaks a simple SQL question
相关话题的讨论汇总
话题: count话题: access话题: name话题: sql话题: column
进入Database版参与讨论
1 (共1页)
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?

1 (共1页)
进入Database版参与讨论
相关主题
aks a simple SQL questionask for help with a simple query!!!
Table Merge (SQL Server)SQL select one value column for each distinct value another (转载)
SQL aggregate multiple columns in ACCESShelp needed
请问这两个SQL QUERY有什么错?请教ssis
SQL combine two tables into one table and add a new column服了,这就是我们QA和DBA的水平
SQL find distinct values in large table一个single table 的 SQL QUERY
SQL combine two columns from two different tables no shared (转载)SQL求助
新手问个简单的SELECT问题请教SQL server的一个programming的问题,谢谢
相关话题的讨论汇总
话题: count话题: access话题: name话题: sql话题: column