MikeL
|
| Posted: 10/07/2002, 11:20 AM |
|
I am tring to create a grid which acts as an overview of records in a database. Basically I'm trying to do a record count on a single db column where records contain various specific values. For example, # of records where db column A = x and another row in the grid with the # of records where db column A = y. I have used the example from article http://gotocode.com/disc_viewt.asp?mid=15435& and it works fine for all of the records returned which meet 1 criteria, but I need to use multiple criteria. Any suggestions would be greatly appreciated.
|
|
|
 |
Ken Hardwick
|
| Posted: 10/07/2002, 3:08 PM |
|
You could write a custom SQL or create a view...
You did not indicate your database..here is how in Oracle...
select
sum(decode(t.gender,'M',1,0)) as Male,
sum(decode(t.gender,'F',1,0)) as Female,
sum(decode(t.gender,'F',0,'M',0,1)) as NotIndicated
from Employees t
Resulting in three columns..total count for male,total count for female and
total count for those not indicated...
For access use iff..I believe...
|
|
|
 |
MikeL
|
| Posted: 10/08/2002, 5:38 AM |
|
Thanks Ken, I apologize; my db is MSSQL2K and I'm using CCS. Also the fields I'm trying to work with are text fields not integer fields. From what I've seen in the SQL help files, SUM only works with numeric values. I know for each table I can use Count(*) From <table> Where <column> = <criteria>, but that only returns one count value. Also, if any other suggestions are available, please include their location within the code. Thanks.
|
|
|
 |
|