Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Date

Status
Not open for further replies.

tickles01

Technical User
Dec 27, 2011
2
0
0
US
I am using business objects and I have 5 different objects with dates, I am looking to return the max date out of those 5 objects. They are not filled out in any sequential order, so i cant say if this then that... I am stuck. Using Max, you can only input one object.

If you need more info let me know.

Thanks!



 
This is pretty easy to solve if you can add a derived table to the universe. You then basically build a union against the five dates and the key as an inline view and then apply a max against the resulting field:

select temp.somekey,max(temp.dt) from
(select somekey,dt1 as dt from ... where dt is not null union all
select somekey,dt2 as dt from ... where dt is not null union all
select somekey,dt3 as dt from ... where dt is not null union all
select somekey,dt4 as dt from ... where dt is not null union all
select somekey,dt5 as dt from ... where dt is not null
) temp
group by somekey

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top