[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Oracle SQL - Count multiple fields

Posted on 2008-06-13
4
Medium Priority
?
3,897 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 252 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 248 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
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.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

656 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