Re: help yourself by helping others

From: Michael A Nachbaur <mike(at)nachbaur(dot)com>
To: "Ali Adams" <aliadams(at)doit4u(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: help yourself by helping others
Date: 2003-07-10 20:00:43
Message-ID: 200307101300.43414.mike@nachbaur.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Friday 04 April 2003 03:10 am, Ali Adams wrote:
> Dear All,
>
> I am new to Relational Databases and SQL and my background in ODBs is
> clouding my way to solving what seems to be a simple problem. I am sure
> many of you have met it many times.
<snip>

Assuming you can have multiple records per day per machine (e.g. you're
polling for information throughout the day), the following holds. However,
the output doesn't provide for a separate column per day, but rather you get
a separate row for each day/machine combination.

Attached is a file that demonstrates the behavior I think you would like. But
basically, here is the SQL statement you're looking for:

SELECT Datestamp, Machine, SUM(Withdrawls)
FROM WithdrawlsTable
GROUP BY Machine, Datestamp
ORDER BY Datestamp, Machine;

--
/* Michael A. Nachbaur <mike(at)nachbaur(dot)com>
* http://nachbaur.com/pgpkey.asc
*/

"A thought seemed to strike the woman. It struck her very slowly. You could
watch it coming in like a long wave on a sandy beach."

Attachment Content-Type Size
pgsql-example.sql text/x-sql 2.0 KB

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-07-11 09:53:16 Re: substr_count
Previous Message Jonathan Gardner 2003-07-10 19:16:06 Re: trigger proceedures in sql