Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index

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.


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?


For unsubscribe instructions e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.