How to join several selects

Поиск
Список
Период
Сортировка
От Josep Sanmartí
Тема How to join several selects
Дата
Msg-id 430C7A21.9020306@openwired.net
обсуждение исходный текст
Ответы Re: How to join several selects  (Sean Davis <sdavis2@mail.nih.gov>)
Re: How to join several selects  (Rod Taylor <pg@rbt.ca>)
Re: How to join several selects  (Zac <zaccheob@inwind.it>)
Список pgsql-sql
Hello,
I have a 'big' problem:
I have the following table users(name, start_time, end_time), a new row 
is set whenever a user logs into a server.  I want to know how many 
users have logged in EVERYDAY between 2 different dates. The only idea 
that I have is making several select (one for each day):   SELECT COUNT(name) FROM users WHERE start_time between
"startDate"
 
and "startDate+1"   SELECT COUNT(name) FROM users WHERE start_time between "startDate+1" 
and "startDate+2"   ...
I would like to know if its possible to make it in 1 sql statement or 
just which is the best efficient way to solve it.
By the way, I use Postgres 7.4.

Thanks!

-- 
Josep Sanmarti
Analista de Projectes

Grup OpenWired, S.L.
Caballero, 87 - 08029 - Barcelona (Spain)
Tel (+34) 93/410 75 70 - Fax (+34) 93/419 45 91



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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Number of rows in a cursor ?
Следующее
От: Sean Davis
Дата:
Сообщение: Re: How to join several selects