SQL Oracle Max of a String

I would like to get the maximum appointment date of a person over a certain date.  In Crystal I would  put this into a formula called LastAppt =[Maximum ({APPOINTMENT. DATE},{@PtName})]  where @PtName is a group of the patient's name and social security #.  Then I would use that formula LastAppt< DateTime (2007,06,30)
I am not sure how to do it in Oracle SQL Developer.
 
This is how I am starting but I am not sure where to put the less than sign with the date.
SELECT Max(APPOINTMENT. DATE), PERSON.PID, PERSON.FULLNAME, APPOINTMENT.APPTSTATUS,  
 PERSON.SSNO, PERSON.DATEOFBIRTH, LOC.ABREVNAME, PERSON.PSTATUS, PERSON.EXTID
 FROM  (ML. APPOINTMENT  APPOINTMENT
 INNER JOIN ML.PERSON PERSON ON APPOINTMENT.PID=PERSON.PID)
 INNER JOIN ML.LOC LOC ON PERSON.HOMELOCATION=LOC.LOCID
 WHERE  PERSON.LAME= 'TEST'
 AND APPOINTMENT.APPTSTATUS=H
 AND PERSON.PSTATUS<>'A'
 GROUP BY PERSON.PID,
 PERSON.FULLNAME, APPOINTMENT.APPTSTATUS,  
 PERSON.SSNO, PERSON.DATEOFBIRTH, LOC.ABREVNAME, PERSON.PSTATUS, PERSON.EXTID
 ORDER BY PERSON.FULLNAME;
trinisunsetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Barry CunneyCommented:
use the HAVING CLAUSE - see below

SELECT Max(APPOINTMENT. DATE), PERSON.PID, PERSON.FULLNAME, APPOINTMENT.APPTSTATUS,  
 PERSON.SSNO, PERSON.DATEOFBIRTH, LOC.ABREVNAME, PERSON.PSTATUS, PERSON.EXTID
 FROM  (ML. APPOINTMENT  APPOINTMENT
 INNER JOIN ML.PERSON PERSON ON APPOINTMENT.PID=PERSON.PID)
 INNER JOIN ML.LOC LOC ON PERSON.HOMELOCATION=LOC.LOCID
 WHERE  PERSON.LAME= 'TEST'
 AND APPOINTMENT.APPTSTATUS=H
 AND PERSON.PSTATUS<>'A'
 GROUP BY PERSON.PID,
 PERSON.FULLNAME, APPOINTMENT.APPTSTATUS,  
 PERSON.SSNO, PERSON.DATEOFBIRTH, LOC.ABREVNAME, PERSON.PSTATUS, PERSON.EXTID
HAVING Max(APPOINTMENT. DATE) < <ENTERDATE>
 ORDER BY PERSON.FULLNAME;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Barry CunneyCommented:
......
.....
HAVING   Max(APPOINTMENT. DATE) <  to_date('30-JUN-07','dd-mmm-yy')
......
......
0
mlmccCommented:
Have you looked at the SQL the report produces?

mlmcc
0
trinisunsetAuthor Commented:
Thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.