Solved

Oracle SQL - Count multiple fields

Posted on 2008-06-13
4
3,893 Views
Last Modified: 2013-12-07
I need to count the number of records within a table for multiple fields.  I am curretnly using count for each filed.  Is there a way to combine the count function?  

Select count(MARKET) from Table1
Select count(SITE) from Table1
Select count(CYCLE) from Table1
Select count(SYSTYPE) from Table1
0
Comment
Question by:SharonInGeorgia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 63 total points
ID: 21781401

Select count(MARKET) 
     , count(SITE)
     , count(CYCLE)
     , count(SYSTYPE)
  From Table1;

Open in new window

0
 
LVL 28

Assisted Solution

by:Naveen Kumar
Naveen Kumar earned 62 total points
ID: 21790802
select count(*) , count(1) from table1 ; -- this will give a count of all the records in the table

select count(market) , count(distinct market ), count(1)
from table1; -- this will give count excluding nulls and count of distinct values excluding nulls and count including nulls

Similary you can do it for other fields. If you need  the counts of the fields in one record output then you have to use as already given above.  If you need in a different format, then let us know and we can try to give you query.

Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question