Count of NULL and NOT NULLS

Count of NULL and NOT NULLS

am 15.12.2006 23:38:38 von jferree

How would I write a query to count the number of instances where a the
PREP field is NULL and when it is not null. I know how to do it
seperately, can I get the numbers in the same query. I want something
like this

Project #PREP_NOTNULL #PREP_NULL

Thanks,

Jim

Re: Count of NULL and NOT NULLS

am 16.12.2006 08:43:59 von que

select concat('isnull(prep) =3D ' ,isnull(prep)) `condition`, count(*)
`count` from your_table group by isnull(prep)

Jim íàïèñà=E2:
> How would I write a query to count the number of instances where a the
> PREP field is NULL and when it is not null. I know how to do it
> seperately, can I get the numbers in the same query. I want something
> like this
>=20
> Project #PREP_NOTNULL #PREP_NULL
>=20
> Thanks,
>=20
> Jim

Re: Count of NULL and NOT NULLS

am 18.12.2006 18:20:46 von jferree

Thanks,

Is there a way to get the counts in the same ROW



que wrote:
> select concat('isnull(prep) =3D ' ,isnull(prep)) `condition`, count(*)
> `count` from your_table group by isnull(prep)
>
> Jim íàïèñà=E2:
> > How would I write a query to count the number of instances where a the
> > PREP field is NULL and when it is not null. I know how to do it
> > seperately, can I get the numbers in the same query. I want something
> > like this
> >
> > Project #PREP_NOTNULL #PREP_NULL
> >=20
> > Thanks,
> >=20
> > Jim

Re: Count of NULL and NOT NULLS

am 20.12.2006 09:03:50 von que

select count(*) nulls, (select count(*) from your_table where not
isnull(prep)) not_nulls from your_table where isnull(prep)

>
> Is there a way to get the counts in the same ROW
>