Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Sql question

Sql question

From: <bcliff_at_my-deja.com>
Date: Mon, 16 Oct 2000 20:32:39 GMT
Message-ID: <8sfol8$2vr$1@nnrp1.deja.com>

I was wondering if there is a way to use a single query in the following scenario:

Table A contains the columns id(PK), fid(FK), status_date, status

Sample data is:

1  id_a  20-Mar-2000  s1
2  id_a  12-Apr-2000  s2
3  id_b  15-Jan-2000  s4
4  id_b  31-Jul-2000  s3
5  id_b  24-Aug-2000  s9
6  id_c  19-May-2000  s6
7  id_c  25-Aug-2000  s7

I want to be able to select each column (select *) where fid equals id_a or id_c but I only want one row returned for all the instances of id_a and one row for all the instances of id_c based upon the most recent status_date for the given fid. In this example, I would want rows with id = 2 and id = 7 returned. Can anyone tell me the sql statement that would produce this result? Thanks for any help you can give me on this.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Oct 16 2000 - 15:32:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US