agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Martin Stöcker <martin.stoecker@stb-datenservice.de>
To: pgsql-sql@lists.postgresql.org
Subject: Re: Query question
Date: Thu, 8 Mar 2018 20:07:30 +0100
Message-ID: <e22d829f-77f2-86c9-e89d-6885bc1fc56d@stb-datenservice.de> (raw)
In-Reply-To: <415803152.48510563.1520535505737.JavaMail.zimbra@rglholdings.com>
References: <415803152.48510563.1520535505737.JavaMail.zimbra@rglholdings.com>

My first idea is to select all equipments and lateral join them to the 5 
most recent events

Regards Martin

Am 08.03.2018 um 19:58 schrieb Stanton Schmidt:
> Hi,
> I am new to the list so feel free to let me know if I am out of line.
>
> My question is:
> I have a table that has log events for pieces of equipment.  For each 
> piece of equipment this table may contain 1 or more (hundreds 
> potentially).
> I need to write a query that will return only the last 5 log events 
> for each (and every) piece of equipment.
>
> log_table (
> equipment_id character(30),
> log_date date,
> log_time time,
> event_desc text
> )
>
> Thanks for your help.
>
> *stanton schmidt*
> *Database Administrator*
> direct. 920. <callto:920.884.1281>471.4495  cell 920.660.1828
>
> RGL
> GO AHEAD.ASKWHAT IF.
> www.RGLlogistics.co m <http://www.rgllogistics.com/;

view thread (15+ messages)  latest in thread

Message-ID: <e22d829f-77f2-86c9-e89d-6885bc1fc56d@stb-datenservice.de>
Permalink:  ../e22d829f-77f2-86c9-e89d-6885bc1fc56d@stb-datenservice.de/
Also on:    postgresql.org/message-id/e22d829f-77f2-86c9-e89d-6885bc1fc56d@stb-datenservice.de

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: martin.stoecker@stb-datenservice.de, pgsql-sql@lists.postgresql.org
  Subject: Re: Query question
  In-Reply-To: <e22d829f-77f2-86c9-e89d-6885bc1fc56d@stb-datenservice.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox