![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a simple way to do this? Obviously the above is a simplified form of the real table which can have hundreds of records for the same organization but only one record is the "latest". |
#3
| |||
| |||
|
|
If I had a table like the following: create table org( id numeric(10,0) identity, org_no char(6) not null, org_name varchar(20) not null, effective_dt datetime not null, primary key (id) ) I need a SQL that will retrieve only the "latest" record for each organization. |
#4
| |||
| |||
|
|
select * from org group by org_no having effective_dt = max(effective_dt) |
![]() |
| Thread Tools | |
| Display Modes | |
| |