Bacula-users

Re: [Bacula-users] sorting output bconsole

2009-10-16 19:58:21
Subject: Re: [Bacula-users] sorting output bconsole
From: Jari Fredriksson <jarif AT iki DOT fi>
To: bacula-users AT lists.sourceforge DOT net
Date: Sat, 17 Oct 2009 02:54:26 +0300


17.10.2009 2:19, Terry L. Inzauro kirjoitti:
For testing, I've decided to use the mysql command line interface and I have 
one last question. How would I take take sums of
two columns such as JobFiles and JobBytes


[18:13:04 root@jenna:~]# mysql -u root -pxxxxx
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 489
Server version: 5.0.51a-24+lenny2-log (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>  use bacula;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>  SELECT DISTINCT Job.JobId as JobId,Client.Name as Client,    
FileSet.FileSet AS FileSet,Level,StartTime,
JobFiles,JobBytes,VolumeName  FROM Client,Job,JobMedia,Media,FileSet  WHERE 
Client.Name='peyton'  AND
Client.ClientId=Job.ClientId AND Job.Type='B'  AND Job.JobStatus='T' AND 
Job.FileSetId=FileSet.FileSetId  AND
JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId  ORDER BY 
Job.StartTime;
+-------+--------+---------------+-------+---------------------+----------+-----------+---------------+
| JobId | Client | FileSet       | Level | StartTime           | JobFiles | 
JobBytes  | VolumeName    |
+-------+--------+---------------+-------+---------------------+----------+-----------+---------------+
|  4700 | peyton | StandardLinux | F     | 2009-09-06 05:28:54 |    47498 | 
789899195 | FullPool_0067 |
|  4777 | peyton | StandardLinux | D     | 2009-09-13 00:37:11 |       50 |   
2442702 | DiffPool_0004 |
|  4910 | peyton | StandardLinux | I     | 2009-09-25 00:28:57 |       43 |   
2095221 | IncrPool_0036 |
|  4921 | peyton | StandardLinux | I     | 2009-09-26 00:29:15 |       41 |   
2072585 | IncrPool_0090 |
|  4932 | peyton | StandardLinux | D     | 2009-09-27 00:53:34 |       52 |   
2497277 | DiffPool_0011 |
|  4943 | peyton | StandardLinux | I     | 2009-09-28 00:29:48 |       50 |   
2366865 | IncrPool_0037 |
|  4954 | peyton | StandardLinux | I     | 2009-09-29 00:28:55 |       41 |   
2018132 | IncrPool_0119 |
|  4965 | peyton | StandardLinux | I     | 2009-09-30 00:38:28 |       41 |   
2035566 | IncrPool_0136 |
|  4976 | peyton | StandardLinux | I     | 2009-10-01 00:29:36 |       41 |   
2052047 | IncrPool_0130 |
|  4987 | peyton | StandardLinux | I     | 2009-10-02 00:31:56 |       45 |   
2069134 | IncrPool_0011 |
|  4998 | peyton | StandardLinux | I     | 2009-10-03 00:29:48 |       41 |   
2085954 | IncrPool_0140 |
|  5009 | peyton | StandardLinux | F     | 2009-10-04 05:36:39 |    47498 | 
789930570 | FullPool_0009 |
|  5020 | peyton | StandardLinux | I     | 2009-10-05 00:29:15 |       50 |   
2378897 | IncrPool_0029 |
|  5031 | peyton | StandardLinux | I     | 2009-10-06 00:29:07 |       41 |   
2029220 | IncrPool_0004 |
|  5042 | peyton | StandardLinux | I     | 2009-10-07 00:51:50 |       41 |   
2046245 | IncrPool_0055 |
|  5053 | peyton | StandardLinux | I     | 2009-10-08 00:28:28 |       41 |   
2062919 | IncrPool_0077 |
|  5108 | peyton | StandardLinux | I     | 2009-10-14 01:25:39 |       50 |   
2430892 | IncrPool_0079 |
|  5119 | peyton | StandardLinux | I     | 2009-10-14 02:41:33 |       50 |   
2431747 | IncrPool_0027 |
|  5130 | peyton | StandardLinux | I     | 2009-10-15 00:30:11 |       41 |   
2073822 | IncrPool_0009 |
|  5141 | peyton | StandardLinux | I     | 2009-10-16 00:30:07 |       41 |   
2091084 | IncrPool_0005 |
+-------+--------+---------------+-------+---------------------+----------+-----------+---------------+
20 rows in set (0.01 sec)

If you want that same list, and add the sums at the end, I don't believe
it is possible with MySQL client. It would be easy with Oracle SQL*Plus,
but not with MySQL client.

A simple query will return those

    SELECT SUM(JobFiles) AS JobFilesSum, SUM(JobBytes) AS JobBytesSum
    FROM Job ;

but that is not much of interest, I guess.


--
http://www.iki.fi/jarif/

Ships are safe in harbor, but they were never meant to stay there.

Attachment: pgp7qivwqbTw3.pgp
Description: PGP signature

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users