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

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.


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.

What is the database backend? You can use Base as a front end to many database engines.

Jay Lozier

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.