Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu0kM-0004Ok-9E for pgsql-sql@arkaria.postgresql.org; Thu, 08 Mar 2018 18:58:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eu0kL-0001My-7P for pgsql-sql@arkaria.postgresql.org; Thu, 08 Mar 2018 18:58:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu0kK-0001I6-U3 for pgsql-sql@lists.postgresql.org; Thu, 08 Mar 2018 18:58:33 +0000 Received: from mx0a-0021dc01.pphosted.com ([148.163.148.220]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eu0kH-00057d-AF for pgsql-sql@lists.postgresql.org; Thu, 08 Mar 2018 18:58:31 +0000 Received: from pps.filterd (m0096559.ppops.net [127.0.0.1]) by mx0a-0021dc01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28Im8Nc027626 for ; Thu, 8 Mar 2018 12:58:27 -0600 Received: from mail.rglholdings.com (dns150.c.register.com [98.102.82.53] (may be forged)) by mx0a-0021dc01.pphosted.com with ESMTP id 2gfpma30nj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 08 Mar 2018 12:58:27 -0600 Received: from mail.rglholdings.com (localhost [127.0.0.1]) by mail.rglholdings.com (Postfix) with ESMTPS id 02D7A158A8A for ; Thu, 8 Mar 2018 12:58:26 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by mail.rglholdings.com (Postfix) with ESMTP id D92AA158B0A for ; Thu, 8 Mar 2018 12:58:25 -0600 (CST) X-Virus-Scanned: amavisd-new at rglholdings.com Received: from mail.rglholdings.com ([127.0.0.1]) by localhost (mail.rglholdings.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Vdu_EPyetcVq for ; Thu, 8 Mar 2018 12:58:25 -0600 (CST) Received: from mail.rglholdings.com (mail.ipa.rglholdings.com [10.1.20.35]) by mail.rglholdings.com (Postfix) with ESMTP id C2941158A8A for ; Thu, 8 Mar 2018 12:58:25 -0600 (CST) Date: Thu, 8 Mar 2018 12:58:25 -0600 (CST) From: Stanton Schmidt To: pgsql-sql@lists.postgresql.org Message-ID: <415803152.48510563.1520535505737.JavaMail.zimbra@rglholdings.com> Subject: Query question MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_7693c1f0-fba7-44ed-a5db-3e829efb2cb8" X-Originating-IP: [10.1.20.35] X-Mailer: Zimbra 8.7.9_GA_1794 (ZimbraWebClient - GC65 (Win)/8.7.9_GA_1794) Thread-Index: cqonmnayXirVt2GEMySUStKaAPKyyg== Thread-Topic: Query question X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-08_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=15 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=358 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803080212 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_7693c1f0-fba7-44ed-a5db-3e829efb2cb8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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. [ callto:920.884.1281 | 920. ] 471.4495 cell 920.660.1828 RGL GO AHEAD. ASK WHAT IF. [ http://www.rgllogistics.com/ | www.RGLlogistics.co m ] --=_7693c1f0-fba7-44ed-a5db-3e829efb2cb8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
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 eve= nts for pieces of equipment.  For each piece of equipment this table m= ay contain 1 or more (hundreds potentially).
I need to write a qu= ery 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_t= ime time,
event_desc text
)

Thanks for your help.

stanton s= chmidt
Database Administrator=
direct. 920.471.4495 &nb= sp;cell 920.660.1828
RGL
GO AHEAD. ASK <= span style=3D"font-weight: bold;">WHAT IF.
www.RGLlogistics.co m

--=_7693c1f0-fba7-44ed-a5db-3e829efb2cb8--