Re: [libreoffice-users] Base/SQL help
This is all confusing to me. How many tables are in this database and what are they? What are the fields and to what table to they belong? What are the field types of each one of the fields? What do you mean by ip and serial are character arrays? Character arrays are not one of the field types nor field properties that I know of. An example of character arrays would be nice too. You use the terms office 1 name, office 2 name, office 1 subtotal, and office 2 subtotal. What are the relationships of these terms to the fields in the database? What I'm trying to do is to create your database to see what could be done. But I can't do that with what you have written: I need more specific information. You speak of a script. Could you share that with us also? --Dan You are 100% correct here is a better example of data and what I'd like as the output form with the given example. CREATE TABLE `storename` ( `store` int(11) NOT NULL, `storename` varchar(20) DEFAULT NULL, ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `storename` VALUES (1,store 1); INSERT INTO `storename` VALUES (2,store 2); CREATE TABLE `printusage` ( `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `serial` varchar(20) NOT NULL, `ip` varchar(15) DEFAULT NULL, `counter` bigint(20) DEFAULT NULL, `webcounter` bigint(20) DEFAULT NULL, `totalprint` bigint(20) DEFAULT NULL, `bwprint` bigint(20) DEFAULT NULL, `copies` bigint(20) DEFAULT NULL, `bwcopies` bigint(20) DEFAULT NULL, `faxes` bigint(20) DEFAULT NULL, `store` int(11) DEFAULT NULL, PRIMARY KEY (`date`,`serial`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','1','192.168.1.50',100,100,100,100,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','2','192.168.1.51',100,100,100,100,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','3','192.168.1.52',100,100,100,100,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','4','192.168.2.50',100,100,100,100,0,0,0,2); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','5','192.168.2.51',100,100,100,100,0,0,0,2); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','1','192.168.1.50',105,105,105,105,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','2','192.168.1.51',105,105,105,105,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','3','192.168.1.52',105,105,105,105,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','4','192.168.2.50',105,105,105,105,0,0,0,2); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','5','192.168.2.51',105,105,105,105,0,0,0,2); example of desired output report. store 1 IP, Serial, Counter Difference from 2011-12-30 00:00:00 to 2011-12-31 00:00:00 192.168.1.50, 1, 5 192.168.1.51, 2, 5 192.168.1.52, 3, 5 store 1 subtotal 15 store 2 IP, Serial, Counter Difference from 2011-12-30 00:00:00 to 2011-12-31 00:00:00 192.168.2.50, 4, 5 192.168.2.51, 4, 5 store 2 subtotal 10 total 25 -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Base/SQL help
On Wed, 2012-01-04 at 10:39 -0700, Jeff Sadowski wrote: This is all confusing to me. How many tables are in this database and what are they? What are the fields and to what table to they belong? What are the field types of each one of the fields? What do you mean by ip and serial are character arrays? Character arrays are not one of the field types nor field properties that I know of. An example of character arrays would be nice too. You use the terms office 1 name, office 2 name, office 1 subtotal, and office 2 subtotal. What are the relationships of these terms to the fields in the database? What I'm trying to do is to create your database to see what could be done. But I can't do that with what you have written: I need more specific information. You speak of a script. Could you share that with us also? --Dan You are 100% correct here is a better example of data and what I'd like as the output form with the given example. CREATE TABLE `storename` ( `store` int(11) NOT NULL, `storename` varchar(20) DEFAULT NULL, ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `storename` VALUES (1,store 1); INSERT INTO `storename` VALUES (2,store 2); CREATE TABLE `printusage` ( `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `serial` varchar(20) NOT NULL, `ip` varchar(15) DEFAULT NULL, `counter` bigint(20) DEFAULT NULL, `webcounter` bigint(20) DEFAULT NULL, `totalprint` bigint(20) DEFAULT NULL, `bwprint` bigint(20) DEFAULT NULL, `copies` bigint(20) DEFAULT NULL, `bwcopies` bigint(20) DEFAULT NULL, `faxes` bigint(20) DEFAULT NULL, `store` int(11) DEFAULT NULL, PRIMARY KEY (`date`,`serial`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','1','192.168.1.50',100,100,100,100,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','2','192.168.1.51',100,100,100,100,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','3','192.168.1.52',100,100,100,100,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','4','192.168.2.50',100,100,100,100,0,0,0,2); INSERT INTO `printusage` VALUES ('2011-12-30 00:00:00','5','192.168.2.51',100,100,100,100,0,0,0,2); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','1','192.168.1.50',105,105,105,105,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','2','192.168.1.51',105,105,105,105,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','3','192.168.1.52',105,105,105,105,0,0,0,1); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','4','192.168.2.50',105,105,105,105,0,0,0,2); INSERT INTO `printusage` VALUES ('2011-12-31 00:00:00','5','192.168.2.51',105,105,105,105,0,0,0,2); example of desired output report. store 1 IP, Serial, Counter Difference from 2011-12-30 00:00:00 to 2011-12-31 00:00:00 192.168.1.50, 1, 5 192.168.1.51, 2, 5 192.168.1.52, 3, 5 store 1 subtotal 15 store 2 IP, Serial, Counter Difference from 2011-12-30 00:00:00 to 2011-12-31 00:00:00 192.168.2.50, 4, 5 192.168.2.51, 4, 5 store 2 subtotal 10 total 25 This looks to be quite feasible. Reports can be created two ways in Base: using the Report Wizard, and using Design View (Create Report using Design View). The latter uses what was originally the Sun Report Builder. Here is a couple of links that might be of use when creating reports in design view: http://www.google.com/search?client=ubuntuchannel=fsq=sunreportbuilderguidebook.pdfie=utf-8oe=utf-8 is a link to a PDF describing how to use the report builder. http://user.services.openoffice.org/en/forum/viewtopic.php?f=47t=39095 is a link to describe how to create user defined functions. (You may not need this for you problem, but it may come in handy later. LibreOffice Base uses HSQLDB. Presently, Base 3.4.4 uses version 1.8. Version 2.2.6 is available as a separate program. The following link will begin the download of the HSQLDB Guide for version 1.8. http://hsqldb.org/doc/guide/guide.pdf --Dan -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Base/SQL help
The SQL is something like SELECT TOP 2 * FROM yourtable ORDER BY counter, DESC WHERE ip = selected ip depending, as Jay says, on your SQL engine. Mark Stanton One small step for mankind... -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Base/SQL help
Jeff , You need a combination of some macro-coding and SQL statements best start is Googling ANDREW BASE DOCUMENT There you will find al you need todo the job Roberto Benitez wrote a exelent book and there is lot of info on his site http://www.baseprogramming.com/ Hope it helps Fernand I can't figure out the best place to get help with SQL to use to get the information I want. Situation: I have a script gathering information about printers daily. It puts the information directly to the database. The fields in the database are date,ip,serial,counter date is a timestamp ip and serial are character arrays and counter is a big int I would like to get the last 2 entries in sql but I can't figure out how to do it in 1 sql statement. I created a script that gets the distinct ip's using one sql statement and sorts them so that all offices entries are together and can be separated by office. then runs a sql statement for each ip to get the last two entries. final output looks like so office 1 name IP, Serial, Couter Diff ip,serial,counter1-counter2 betweendate1 anddate2 ... office 1 name Subtotaloffice 1 subtotal office 2 name IP, Serial, Couter Diff ip,serial,counter1-counter2 betweendate1 anddate2 ... office 2 name Subtotaloffice 2 subtotal ... I'd like to be able to do this in a report in LibreOffice under Base but can't figure out how to use base to do what my script does. I never had anything like this situation in any of my classes on databases so I am lost on how to begin. All I remember reports on where things that could be gotten with a single sql statement. -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Base/SQL help
Hi :) There is some documentation on this page http://wiki.documentfoundation.org/Documentation/Publications#LibreOffice_Base_Guide I am not sure if it gets into Sql statements or even as far as Queries yet but it might be worth having a quick glance. Regards from Tom :) --- On Tue, 3/1/12, Mark Stanton m...@vowleyfarm.co.uk wrote: From: Mark Stanton m...@vowleyfarm.co.uk Subject: Re: [libreoffice-users] Base/SQL help To: users@global.libreoffice.org Date: Tuesday, 3 January, 2012, 8:57 The SQL is something like SELECT TOP 2 * FROM yourtable ORDER BY counter, DESC WHERE ip = selected ip depending, as Jay says, on your SQL engine. Mark Stanton One small step for mankind... -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Base/SQL help
On Mon, 2012-01-02 at 15:05 -0700, Jeff Sadowski wrote: I can't figure out the best place to get help with SQL to use to get the information I want. Situation: I have a script gathering information about printers daily. It puts the information directly to the database. The fields in the database are date,ip,serial,counter date is a timestamp ip and serial are character arrays and counter is a big int I would like to get the last 2 entries in sql but I can't figure out how to do it in 1 sql statement. I created a script that gets the distinct ip's using one sql statement and sorts them so that all offices entries are together and can be separated by office. then runs a sql statement for each ip to get the last two entries. final output looks like so office 1 name IP, Serial, Couter Diff ip,serial,counter1-counter2 between date1 and date2 ... office 1 name Subtotal office 1 subtotal office 2 name IP, Serial, Couter Diff ip,serial,counter1-counter2 between date1 and date2 ... office 2 name Subtotal office 2 subtotal ... I'd like to be able to do this in a report in LibreOffice under Base but can't figure out how to use base to do what my script does. I never had anything like this situation in any of my classes on databases so I am lost on how to begin. All I remember reports on where things that could be gotten with a single sql statement. This is all confusing to me. How many tables are in this database and what are they? What are the fields and to what table to they belong? What are the field types of each one of the fields? What do you mean by ip and serial are character arrays? Character arrays are not one of the field types nor field properties that I know of. An example of character arrays would be nice too. You use the terms office 1 name, office 2 name, office 1 subtotal, and office 2 subtotal. What are the relationships of these terms to the fields in the database? What I'm trying to do is to create your database to see what could be done. But I can't do that with what you have written: I need more specific information. You speak of a script. Could you share that with us also? --Dan -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
[libreoffice-users] Base/SQL help
I can't figure out the best place to get help with SQL to use to get the information I want. Situation: I have a script gathering information about printers daily. It puts the information directly to the database. The fields in the database are date,ip,serial,counter date is a timestamp ip and serial are character arrays and counter is a big int I would like to get the last 2 entries in sql but I can't figure out how to do it in 1 sql statement. I created a script that gets the distinct ip's using one sql statement and sorts them so that all offices entries are together and can be separated by office. then runs a sql statement for each ip to get the last two entries. final output looks like so office 1 name IP, Serial, Couter Diff ip,serial,counter1-counter2 between date1 and date2 ... office 1 name Subtotal office 1 subtotal office 2 name IP, Serial, Couter Diff ip,serial,counter1-counter2 between date1 and date2 ... office 2 name Subtotal office 2 subtotal ... I'd like to be able to do this in a report in LibreOffice under Base but can't figure out how to use base to do what my script does. I never had anything like this situation in any of my classes on databases so I am lost on how to begin. All I remember reports on where things that could be gotten with a single sql statement. -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
Re: [libreoffice-users] Base/SQL help
On 01/02/2012 05:05 PM, Jeff Sadowski wrote: I can't figure out the best place to get help with SQL to use to get the information I want. Situation: I have a script gathering information about printers daily. It puts the information directly to the database. The fields in the database are date,ip,serial,counter date is a timestamp ip and serial are character arrays and counter is a big int I would like to get the last 2 entries in sql but I can't figure out how to do it in 1 sql statement. I created a script that gets the distinct ip's using one sql statement and sorts them so that all offices entries are together and can be separated by office. then runs a sql statement for each ip to get the last two entries. final output looks like so office 1 name IP, Serial, Couter Diff ip,serial,counter1-counter2 betweendate1 anddate2 ... office 1 name Subtotaloffice 1 subtotal office 2 name IP, Serial, Couter Diff ip,serial,counter1-counter2 betweendate1 anddate2 ... office 2 name Subtotaloffice 2 subtotal ... I'd like to be able to do this in a report in LibreOffice under Base but can't figure out how to use base to do what my script does. I never had anything like this situation in any of my classes on databases so I am lost on how to begin. All I remember reports on where things that could be gotten with a single sql statement. What is the database backend? You can use Base as a front end to many database engines. -- Jay Lozier jsloz...@gmail.com -- For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted