From: Rod Taylor <pg@rbt.ca>
To: Josep SanmartĂ <josep.sanmarti@openwired.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to join several selects
Date: Wed, 24 Aug 2005 09:52:04 -0400
Message-ID: <1124891524.36010.64.camel@home> (raw)
In-Reply-To: <430C7A21.9020306@openwired.net>
References: <430C7A21.9020306@openwired.net>
On Wed, 2005-08-24 at 15:46 +0200, Josep SanmartĂ wrote:
> 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"
You have columns named "startDate+2" or are you adding 2 days to a
column named "startDate"?
--
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: pg@rbt.ca, josep.sanmarti@openwired.net
Subject: Re: How to join several selects
In-Reply-To: <1124891524.36010.64.camel@home>
* 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