Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. DECLARE latest_exam date;
  2.  
  3. SELECT DATE(MAX(ex_date))
  4. INTO latest_exam
  5. FROM vets
  6. WHERE an_id = p_animal_id
  7. GROUP BY an_id;
  8.  
  9. SELECT latest_exam, and a bunch of other stuff. ;
  10.  
  11. SELECT x.maxDate,
  12. b.*
  13. FROM tableName b,
  14. (
  15. SELECT DATE (max(ex_date)) maxDate
  16. FROM vets
  17. WHERE an_id = p_animal_id
  18. GROUP BY an_id
  19. ) x
  20.  
  21. select latest_exam = date(max(ex_date))..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement