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.

 All Forums
 Other Forums
 MS Access
 How to do this in sql

Author  Topic 

ricopauw
Starting Member

1 Post

Posted - 2002-12-03 : 06:38:28
Hi,

In the table there is a somefield which can be 1 of 5 values, indicating a type. I want to count how many times each type occurs in the data. I'm using MS Acces 97 ( :( )

In pseudocode I want to do:
for each unique somefield do
select Count FieldID
print result
Next

I tried:
select count (FieldID) as field1
from table1
where (some conditions AND somefield = thefield
union
select distinct somefield AS thefield
from table1 'yes, it's all in one table even the somefield & thefield are the same physical column
where somecondition

Regards,
rico




mr_mist
Grunnio

1870 Posts

Posted - 2002-12-03 : 06:42:38
Select count(field), type
group by type



-------
Moo.
Go to Top of Page
   

- Advertisement -