Re: is it possible to get the number of rows of a table?

Поиск
Список
Период
Сортировка
От Haller Christoph
Тема Re: is it possible to get the number of rows of a table?
Дата
Msg-id 200109270717.JAA23391@rodos
обсуждение исходный текст
Ответ на is it possible to get the number of rows of a table?  (Frederick Klauschen <fklauschen@yahoo.com>)
Список pgsql-sql
> 
> 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 



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

Предыдущее
От: Carl van Tast
Дата:
Сообщение: Re: Subquery with IN or EXISTS
Следующее
От: bulk@colonnello.org (Paolo Colonnello)
Дата:
Сообщение: Simple Query HELP!!!