Re: Need help with query in Oracle 8.1.7

From: Shakespeare <>
Date: Fri, 24 Oct 2008 14:23:46 +0200
Message-ID: <4901be4e$0$189$>

"gazzag" <> schreef in bericht On 24 Oct, 12:25, Brian K <> wrote:
> I have an older database system which I have inherited and need to extract
> some data on.
> I am having trouble with a query.
> The query in question runs against a table with five columns:
> Primary key:
> Additional columns:
> There are a few hundred thousand total rows in this table.
> The table is used to store patient headcount, and is grouped by
> facid/deptid. CENUPD is a date field storing the DD-MM-YY of the census,
> and CENUPT stores the HH24:MI:SS of the census in a text format.
> The FACID is a facility ID, the DEPTID is a department ID within a
> facility.
> The challenge I have is to craft a query with PL/SQL to roll these values
> up in such a way that I return ONLY the MOST RECENT cenupd, cenupt, and
> cencount values for each distinct combination of FACID and DEPTID. Out of
> the hundred thousand total rows I should have a few hundred combinations
> of FACID and DEPTID.
> I appreciate your help, and please do not hesitate to ask for more
> information.

DDL to create the table plus some DML to populate it with some sample data will get you help quicker.

HTH -g

Wouldn't a select max( ) group by

be enough to do the job?

Shakespeare Received on Fri Oct 24 2008 - 07:23:46 CDT

Original text of this message