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

Home -> Community -> Usenet -> c.d.o.tools -> Re: returning records with count grouping

Re: returning records with count grouping

From: Christoph Gehrke <christoph.gehrke_at_schulte-gehrke.de>
Date: Tue, 15 Aug 2000 12:56:41 +0100
Message-ID: <8nbb8l$a54$11$1@news.t-online.com>

HI,
your statement is correct (and also the result). try:

"select count(*), firstname from blah where upper(firstname) = '%MANSOOR%' group
by firstname"

'mansoor' <> 'Mansoor'<> 'mansoor '....

Christoph

mansoorzaidi_at_my-deja.com schrieb in Nachricht <8n9mea$i19$1_at_nnrp1.deja.com>...
>Hello all,
>
>I hope somebody can help with this problem I'm having.
>
>Basically, whenever you use count(*) with a single grouping, you always
>get a number back. So, for instance, if there was no record on table
>blah where column firstname equaled "mansoor", then this count would
>return a zero
>
>"select count(*) from blah where firstname = 'mansoor'"
>
>would get:
>
>COUNT(*)
>--------
> 0
>
>
>Now, I can group and try to get a total count by using count like this:
>
>"select count(*), firstname from blah where firstname = 'mansoor' group
>by firstname"
>
>but Oracle will reply with "no rows selected"
>
>Is there any way in which I can force Oracle to give back a record
>something along the lines of:
>
>COUNT(*) FIRSTNAME
>-------- ---------
> 0 mansoor
>
>Any help in this matter is appreciated. Thank you.
>
>Mansoor Zaidi
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Tue Aug 15 2000 - 06:56:41 CDT

Original text of this message

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