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@nachbaur.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."