Re: Query question - Mailing list pgsql-sql

From Martin Stöcker
Subject Re: Query question
Date
Msg-id e22d829f-77f2-86c9-e89d-6885bc1fc56d@stb-datenservice.de
Whole thread Raw
In response to Query question  (Stanton Schmidt <sschmidt@rgllogistics.com>)
Responses Re: Query question  (Stanton Schmidt <sschmidt@rgllogistics.com>)
List pgsql-sql
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.471.4495  cell 920.660.1828

RGL
GO AHEAD. ASK WHAT IF.
www.RGLlogistics.co m


pgsql-sql by date:

Previous
From: Stanton Schmidt
Date:
Subject: Query question
Next
From: Stanton Schmidt
Date:
Subject: Re: Query question