Hello all, I would like to ask fot the query if I want to compare two columns which are of DATE type, I need to get the latest date. Thanks a lot.
(Suppose two columns are "TMODDATE" and "TADDDATE".
Hi,
Here is a sample query which will get the altest of two dates. The table used is employee table on sample database. Hope this helps.
DB2 "WITH TEMP AS (select case when (hiredate > birthdate) then 0 else 1 end as value from employee where empno = '000010') SELECT CASE VALUE WHEN 0 THEN HIREDATE ELSE BIRTHDATE END FROM TEMP,EMPLOYEE WHERE EMPNO='000010'"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.