Iam using a count along with a group by condition. (Eg., Select count(col1),
col1 from table1 where col1 = <value> group by col1)
If I run the query and if no matching records if found the result doesnt sho
w anything. Why is this so?. But if I give
count(column) without the group by condition then a single record is fetched
based on no of records..
I not able to really see why the first one is not returning any records if t
he condition does not match.
Thanx in advance
regards
MaheshBasically, when the condition does not match, there is nothing is count (it
is a empty result set), which causes nothing to be displayed.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Mahesh" <anonymous@.discussions.microsoft.com> wrote in message
news:0E67C7CE-7744-41D3-B733-17E6BF42E9E4@.microsoft.com...
quote:
> Hi,
> Iam using a count along with a group by condition. (Eg., Select
count(col1),col1 from table1 where col1 = <value> group by col1)
quote:
> If I run the query and if no matching records if found the result doesnt
show anything. Why is this so?. But if I give
quote:
> count(column) without the group by condition then a single record is
fetched based on no of records..
quote:
> I not able to really see why the first one is not returning any records if
the condition does not match.
quote:|||If you want to see the count and the value of Col1 then you can do so like
>
> Thanx in advance
> regards
> Mahesh
>
this:
SELECT COUNT(*), <value>
FROM Table1
WHERE col1 = <value>
David Portas
--
Please reply only to the newsgroup
--
No comments:
Post a Comment