Re: How to get Rows Count

Поиск
Список
Период
Сортировка
От Iain
Тема Re: How to get Rows Count
Дата
Msg-id 022701c3ff41$69646490$7201a8c0@mst1x5r347kymb
обсуждение исходный текст
Ответ на How to get Rows Count  (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)



В списке pgsql-sql по дате отправления:

Предыдущее
От: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Дата:
Сообщение: Re: PLSQL Question regarding multiple inserts
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: User defined types -- Social Security number...