Re: How could select count(*) return no row ???

From: McGrath Glenda <glenda_at_beta.lanl.gov>
Date: 1995/08/18
Message-ID: <412rtp$ih3_at_newshost.lanl.gov>#1/1


In article <410h0t$972_at_volcano.jrv.qc.ca>, Alain Barrette <barrette_at_jrv.qc.ca> wrote:
>If I use the following statement
>
>Select count(*) from table
>where 1 = 0,
>It return 0.
>
>If however I try to do something like
>
>Select count(*) from table
>where 0 = (select count(*) from table where 1 = 0);
>
>It give me no rows selected ?!?!?
>
>How or why could this be ?
>

I did the following:

    select count(*)

      from dual 
     where 1 = 0;

with the following result:

       COUNT(*)
     ----------
              0

Then I did:

    select count(*)

      from dual
     where 0 = (select count(*) 
                  from dual
                  where 1 = 0);

with the following result:

       COUNT(*)
     ----------
              1

Don't know what you did wrong ... but I got what was expected.

glenda Received on Fri Aug 18 1995 - 00:00:00 CEST

Original text of this message