0

Hi Guys,

How do i obtain the nearest shipdate prior to Returndate.
here is my sample script. thanks. kindly check my script.

the result should be 2011-02-23

Table1
ESN--DateReturn
123--2011-03-08

TABLE2

ESN---ShipDate
123---2010-09-28 
123---2011-02-23 

Select 
	a.DateReturn
	max(b.shipdate)
from Table1 as a
left outer join table2 as b
on a.esn=b.esn
and b.shipdate <= returndate

Thank you.

JOV

Edited by jovillanuev: n/a

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by jovillanuev
0

I got it. here is my script..any comments. or other option. thanks.

Select
a.DateReturn
max(b.shipdate)
from Table1 as a
left outer join table2 as b
on a.esn=b.esn
and b.shipdate <= returndate

Result:
123---2011-02-23

Edited by jovillanuev: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.