Row Count

From: Sergey Gigoyan <sergey(dot)gigoyan(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Row Count
Date: 2013-02-12 07:05:20
Message-ID: CAFaFzo6uSe8Q0Y9tzfQk_rBxSnQy+Z-CNmbTjXNEJ=QBFOf8XQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

How can I get selected row count in one statement?
For example, I can do that by two select statements

select id, name, addrress, (select count(*) from(select id
from
users
where
name<>'examplename')
from users
where name<>'examplename'

or

declare rowcount integer
...............
rowcount:=select count(*) from(select id
from users
where name<>'examplename')
as rst

select id, name, address, rowcount as rowcount
from users
where name<>'examplename'

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Thomas Kellerer 2013-02-12 08:00:33 Re: Row Count
Previous Message Jack Kaufman 2013-02-11 19:58:55 Re: Function name