Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to remove last Date from table

Hi Friends

I want to remove last Date records from Table Dynamically

Eg:

Date

01/01/2016

02/01/2016

03/01/2016

Here I need to remove 03/01/2016. I need to do this dynamically why because after some time the date may be change. Guys can u please help me on this

Thanks & Regards

Abi

10 Replies
arulsettu
Master III
Master III

have you tried

Max(date)-1

Kushal_Chawda

Can you tell us what is the purpose of removing last date ? Do you want to achieve it from front end or back end?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Temp:

LOAD

Date,

'

'

'

FROM DataSource;

Left JOin(Temp)

LOAD

Max(Date) AS Date,

1 AS Flag

RESIDENT Temp;

Data:

Noconcatenate

LOAd

*

RESIDENT Temp

WHERE Flag <> 1;

DROP TABLE Temp;

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable
Author

max(date)-1

senpradip007
Specialist III
Specialist III

Try like:

Temp:

LOAD

Max(Date) as MxDate

FROM DataSource;


let vMaxDate = peek('Date', 0,'Temp');

Drop table Temp;

FinalTab:

Load *

FRM DataSource

Where Date < $(vMaxDate);

Digvijay_Singh

Try this -

t1:

Load * inline [

Date

01/01/2016

02/01/2016

03/01/2016 ];

Let vLast = FieldValue('Date',NoOfRows('t1'));

NoConcatenate

t2:

Load *

Resident t1

Where Date<>'$(vLast)';

DROP Table t1;

amit_saini
Master III
Master III

Hi,

Try:

Max(Date_Field ) as Latest_Date

and later

where Date_Field <> max(Date_Field);

Thanks

AS

jonathandienst
Partner - Champion III
Partner - Champion III

@Jagan

I think you need:

Data:

Noconcatenate

LOAd

*

RESIDENT Temp

WHERE Flag <> 1 Or IsNull(Flag);

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tresesco
MVP
MVP

@Jonathan

I guess

....

WHERE Flag <> 1 alone is good enough here. Am I missing something? The Isnull() would be implicit here.