Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2002-01-23 : 09:18:02
|
I tried 2 different ways:1-select count(column_name) from (select distinct column_name from table_name where this = 'a' and that = 'b')2-select count(distinct column_name) from table_name where this = 'a' and that = 'b'How can I do a count of distinct in access?DanielSQL Server DBA |
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-01-23 : 09:33:11
|
I tried your first option in Access2k and it seems to work just fine. What happens when you run it? Is it giving you an error or coming back with an incorrect result?-------------------If trainstation is a place where train stops, what's a workstation? |
 |
|
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2002-01-23 : 09:39:05
|
quote: I tried your first option in Access2k and it seems to work just fine. What happens when you run it? Is it giving you an error or coming back with an incorrect result?-------------------If trainstation is a place where train stops, what's a workstation?
Actually I guess this must be an Access 97 limitation. It gives me a syntax error."Syntax error missing operator in count(distinct column_name)"So if the 1st query works in access 2k then I guess its something that was not in access until then =( (maybe it does pay to upgrade hehehe)DanielSQL Server DBA |
 |
|
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2002-01-23 : 09:40:19
|
Oh BTW thanks for the reply and for testing it... DanielSQL Server DBA |
 |
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-01-23 : 10:30:06
|
Yeah, I think 97 didn't understand derived tables. But if you saved the query that does the DISTINCT, you could base your other queries off of it... Kinda like using a view in SQL.-------------------If trainstation is a place where train stops, what's a workstation? |
 |
|
|
|
|