MySQL Forums
Forum List  »  Triggers

Re: Help with trigger
Posted by: laptop alias
Date: April 23, 2012 08:00AM

Generally, it's a bad idea to store the same thing twice!
SELECT p.*
     , MAX(a.date_of_appointment) date_of_last_appointment
  FROM patients p
  JOIN appointment a
    ON a.patient_id = p.patient_id
   AND a.status {[=/!=/IN] (something)}/{IS NOT NULL} 
 GROUP
    BY patient_id;

You can store this query as a VIEW

Options: ReplyQuote


Subject
Views
Written By
Posted
2289
April 23, 2012 04:35AM
Re: Help with trigger
1086
April 23, 2012 08:00AM
1186
April 23, 2012 08:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.