Re: Simple SQL problem
Posted in 1993
->From: kraehe@bakunin.north.de (michael kraehe)
->Subject: Simple SQL problem
->Date: 1 Jul 93 21:44:47 GMT
->Reply-To: kraehe@bakunin.north.de (michael kraehe)
->Organization: Unix ohne So~en taug nix
->
->Lets say I've a table containing the downloads on my machine.
->
->The Columnes are named "user,path,file,size" Now I want info on how
->often each file is downloaded, and how many bytes every user has donwloaded ?
->
->Can this be done by a simple SQL-Statement.
->
->By Michael.
->--
->Reply : Short Mail Michael_Kraehe@hb.maus.de - Voice : 04204 1497
-> Long UU's kraehe @ bakunin.north.de - V32b : 0421 870532
->
-> " ceterum censeo MSDOS delendam esse " sagt der Guru und krault seinen Bart
->
Michael,
If I properly understood your problem, then the following queries should
do what you want:
SELECT file, COUNT(*) how_often
FROM tafel
GROUP BY file;
SELECT user, SUM(size) total_bytes
FROM tafel
GROUP BY user;
Regards,
Alan ___________________________
______________________| R. Alan Popiel |__________________________
\\ Internet: | Martin Marietta, Tech Ops | /
\\ alan@den.mmc.com | P.O. Box 179, M/S 5422 | Std disclaimers apply. /
)Voice: | Denver, CO 80201-0179 USA | (
/ 303-977-9998 |___________________________| (But you knew that!) \\
/________________________) (____________________________\\