Guys,

Please take a look my script.
my object here is to get the most recent date from table 2.
what if the recent date from table 2 is less than the date from table 1?

Table1

Type-Date1
--------
1-2011-07-16
2-2011-07-16 
3-2011-07-10 
4-2011-07-10 

Table2

Type-Date2
--------
1-2011-07-06 
2-2011-07-07 
3-2011-07-01 
4-2011-07-01 
 
Select 
    min(Date2)
From Table1 as a
Left outer join table2 as b
on a.type = b.type
and date2 > date1


regards,
JOV

Recommended Answers

All 3 Replies

Is your script is giving any result? i could see where condition is missing in script. you want recent date only from table 2 ? what is the relation between table1 and table 2?

The where clause condition is Date also. Yes from table2. the relation of table 1 and table 2 is the type.

If your object is to get most recent date only from table 2 Why cant u just do select top 1 coulumn order by column desc?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.