Re: How to get Rows Count - Mailing list pgsql-sql

From Iain
Subject Re: How to get Rows Count
Date
Msg-id 022701c3ff41$69646490$7201a8c0@mst1x5r347kymb
Whole thread Raw
In response to How to get Rows Count  (Abdul Wahab Dahalan <wahab@mimos.my>)
List pgsql-sql
howabout:

select sum(case when c =  '*' then 0 else 1 end) as count_not_star from
tablename

If you want to process all records but only count thouse without a * in c
then this will do the trick.

regards
iain
----- Original Message ----- 
From: "Abdul Wahab Dahalan" <wahab@mimos.my>
To: <pgsql-sql@postgresql.org>
Sent: Monday, March 01, 2004 11:06 AM
Subject: [SQL] How to get Rows Count


> >
> >
> >a       b      d    c
> >01      02     b    *
> >01      02     a    *
> >02      03
> >02      04     b    *
> >02      04     a    *
> >03      05
> >04      06
> >
> If I've a table like above, how do I make a query to get rows count that
> doesnt have '*' in it.
>
> Can we have other queries than this : Select count(c) from tablename
> where c !='*';
> or Select count(c) from tablename where c <> '*';
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



pgsql-sql by date:

Previous
From: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
Subject: Re: PLSQL Question regarding multiple inserts
Next
From: Christopher Browne
Date:
Subject: Re: User defined types -- Social Security number...