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 -> please help me in building a SQL query...........

please help me in building a SQL query...........

From: techimadhu <madhusudan.hv_at_gmail.com>
Date: 4 Jan 2005 23:53:06 -0800
Message-ID: <1104911586.208496.182380@z14g2000cwz.googlegroups.com>


I have two tables

  1. Person2Address Table Columns - Personuid, addressuid there is no primary key for this table.
  2. Address Table Columns - addressuid(which is a guid), addresstext, validitystartdate

typical data in the tables are like this

person2Address table



personuid addressuid
1             4
1             5
2             6
3             7
3             8

Address Table



addressuid addresstext validitystartdate
4              abcd         01-09-82
5              xyz          01-10-95
6              pqrs         08-09-78
7              mnop         04-08-80
8              huil         04-08-80

I want each persons addresstext which is having the latest validity start date.
if for a person two addresses have same validity start period then i have to show any one of that.

ie the result should be

personuid addresstext


1             xyz
2             pqrs
3             mnop

i need to write a single query to achive this.

note: addressuid is actually not numeric, it is actually alphanumeric and not generated in sequential order. Received on Wed Jan 05 2005 - 01:53:06 CST

Original text of this message

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