max date = sysdate-18 in where clause !!
437329Dec 30 2008 — edited Dec 30 2008Hi all,
Please ,
My request is i have many mit_date for a perticular stu_name and i wanted the max(mit_date), but this mit_date must not be within last 18 months from sysdate.
here is what i meant in query form
SELECT MAX(MIT_DATE),STU_NAME FROM USA_MIT_TBL WHERE MIT_DATE <= (SYSDATE-18) -- this is what i am dreaming .
or
select mit_date,stu_name from mit_usa_tbl where mit_date =(
select MAX(MIT_DATE) from USA_MIT_TBL UD WHERE UD.MIT_DATE <= (SYSDATE-18)) -- THIS ONE IS ALSO NOT WORKable
the present data as follows
I have a stu_name like John Smith who have mit_date as follows
01/20/2001
01/20/2002
01/20/2007
01/20/2008 . from this perticular stu_name, i am looking for the date "01/20/2007" which is not with in 18 months from sysdate and which is max (mit_date) compare to 01/20/2001 and 01/20/2002.
note: - this table have more than one stu_name
somone please help me in this .
appreciate all help.