Select records where date = maxdate

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
gopskrish
Participant
Posts: 37
Joined: Thu Mar 31, 2005 7:42 am

Select records where date = maxdate

Post by gopskrish »

Hi Guys,

I am using Sybase as the source and i would like to retrieve records where <date> = max(date) in the database.

How can i get that ?

Can anyone help me on this.

source sybase
job Parallel
tgt sequential

cheers,
gops
Sunshine2323
Charter Member
Charter Member
Posts: 130
Joined: Mon Sep 06, 2004 3:05 am
Location: Dubai,UAE

Post by Sunshine2323 »

Hi,

You can get your date in this format YYYYMMDD and then pass the data through an Aggregator to find the max date.
Warm Regards,
Amruta Bandekar

<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post by ogmios »

How about:

Code: Select all

select columns, ...
from table
where date = ( select max(date) from table )
in Sybase... the biggest disadvantage of calculating the maximum in DataStage is that you have the I/O from Sybase to DataStage (where depending on your input a lot of data is not useful).

Ogmios
In theory there's no difference between theory and practice. In practice there is.
Post Reply