From: | "Iain" <iain(at)mst(dot)co(dot)jp> |
---|---|
To: | "Abdul Wahab Dahalan" <wahab(at)mimos(dot)my>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to get Rows Count |
Date: | 2004-03-01 03:58:09 |
Message-ID: | 022701c3ff41$69646490$7201a8c0@mst1x5r347kymb |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)mimos(dot)my>
To: <pgsql-sql(at)postgresql(dot)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(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Browne | 2004-03-01 04:11:31 | Re: User defined types -- Social Security number... |
Previous Message | Michael Chaney | 2004-03-01 03:20:50 | Re: Postgres DB |