Re: find the number of row for each tables

Поиск
Список
Период
Сортировка
От NRonayette
Тема Re: find the number of row for each tables
Дата
Msg-id 39489705.97BC78ED@socotec.fr
обсуждение исходный текст
Ответ на find the number of row for each tables  (Patrick Coulombe <11h11@videotron.ca>)
Ответы Re: find the number of row for each tables  ("D. Duccini" <duccini@backpack.com>)
Список pgsql-novice
Hi everybody,
i try something that could work (i tested it on a Oracle base, and it
works fine, sorry, i haven't got postgresql at my office :-((

select count(distinct (<Primary_key_of_friends>)), count(distinct
(<Primary_key_of_strangers>))
from Friends, Strangers
WHERE friends.f_id = strangers.s_id AND friends.categorie = 1;

If f_id and S_id are the primary key of each table, replace
<primary_key_of_friend> and <primary_key_of_strangers> by f_id and s_id
respectively.

i hope this will work for you

Nicolas

Patrick Coulombe wrote:
>
> > Try simply SELECT * from friends;
> ???
> Not working... I just want to know if it's possible to know how many rows
> the query return for each table when i do a query with two table ie: select
> * from table1, table2 where...
>
> can i know the number of row for table1 and the number of row for table2
> without do 2 querys.
>
> thank you
> hope to be more clear this time
> patrick
>
> > On Tue, 13 Jun 2000, Patrick Coulombe wrote:
> >
> > > hi,
> > > here's the question : if I do this query on my database :
> > >
> > > SELECT * from friends, strangers WHERE friends.f_id = strangers.s_id AND
> > > friends.categorie = 1
> > > ----------
> > > 88 rows
> > >
> > > and I need to do this query to know how many rows just for my table
> friends
> > > (not both table) :
> > >
> > > SELECT * from friends WHERE friends.f_id = strangers.s_id AND
> > > friends.categorie = 1
> > > ----------
> > > 80 rows
> > >
> > >
> > > Can I just do 1 query and be able to find the number of row for each
> tables?
> > > Hope to be understand...
> > >
> > > Patrick

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

Предыдущее
От: Jesus Aneiros
Дата:
Сообщение: Re: find the number of row for each tables
Следующее
От:
Дата:
Сообщение: Re: [NOVICE] Maximum size before having to use BLOBs.