pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Haller Christoph <ch@rodos.fzk.de>
To: fklauschen@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: is it possible to get the number of rows of a table?
Date: Thu, 27 Sep 2001 9:17:03 METDST
Message-ID: <200109270717.JAA23391@rodos> (raw)
In-Reply-To: <20010926151432.46962.qmail@web10105.mail.yahoo.com>

> 
> I would like to compare the number of rows
> of one table and of another and use it in
> a  query like this:
> SELECT * FROM xxxx
> WHERE   "number of rows of table xxxx"
>                   EQUALS
>                    "number of rows of table yyyy"
> i.e. I only want get a query result if the tables
> have the same number of rows.
> Is there a function or a way to do this ?
> 
> Thanks,
> Frederick
> 
Basically, the way to find out about the number of rows 
of a table is "select count(*) from t1"
But the select statement above looks odd to me 
(no offence intended). 
To receive a selection of certain rows of a table 
you have to reference at least one column of that 
table in the where clause like in 
"select * from table1 t1 where t1.c1 = (select count(*) from t2)" 
I hope this helps at least a bit. 
Regards, Christoph 




view thread (3+ messages)  latest in thread

Message-ID: <200109270717.JAA23391@rodos>
Permalink:  ../200109270717.JAA23391@rodos/
Also on:    postgresql.org/message-id/200109270717.JAA23391@rodos

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ch@rodos.fzk.de, fklauschen@yahoo.com
  Subject: Re: is it possible to get the number of rows of a table?
  In-Reply-To: <200109270717.JAA23391@rodos>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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