Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Statement

Re: SQL Statement

From: Tim X <timx_at_spamto.devnul.com>
Date: 20 May 2003 18:57:01 +1000
Message-ID: <87fznac7xe.fsf@tiger.rapttech.com.au>


>>>>> "Henry" == Henry <no_at_spam.com> writes:

 Henry> Hi, I am trying to count number of records containing certain  Henry> states.

 Henry> SELECT COUNT(state) from CLIENTS WHERE STATE = 'CA';

 Henry> However, I am trying to count 5 different states in the same
 Henry> statement, is that possible to do this?.....first find all the
 Henry> states that I am looking for: CA, NY, AZ, MI, FL......then
 Henry> count how many records each state had.

 Henry> Output would look like this:

 Henry> CA - 3 NY - 12 AZ - 19 MI - 23 FL - 1

Read up about the "group by" statement - that should give you what you are after.

Tim

-- 
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you 
really need to send mail, you should be able to work it out!
Received on Tue May 20 2003 - 03:57:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US