pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to get Rows Count
2+ messages / 2 participants
[nested] [flat]

* How to get Rows Count
@ 2004-03-01 02:06  Abdul Wahab Dahalan <wahab@mimos.my>
  0 siblings, 1 reply; 2+ messages in thread

From: Abdul Wahab Dahalan @ 2004-03-01 02:06 UTC (permalink / raw)
  To: pgsql-sql

>
>
>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 <> '*';





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: How to get Rows Count
@ 2004-03-01 03:58  Iain <iain@mst.co.jp>
  parent: Abdul Wahab Dahalan <wahab@mimos.my>
  0 siblings, 0 replies; 2+ messages in thread

From: Iain @ 2004-03-01 03:58 UTC (permalink / raw)
  To: Abdul Wahab Dahalan <wahab@mimos.my>; 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)




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-03-01 03:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-03-01 02:06 How to get Rows Count Abdul Wahab Dahalan <wahab@mimos.my>
2004-03-01 03:58 ` Iain <iain@mst.co.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox