CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Multiple record counts on same DB column

Print topic Send  topic

Author Message
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.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.