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: [email protected]
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

Reply via email to