-6

I need help in calculating the length of days based on Discharge_date and admission_date for all the admission_id. thanks

ADMISSION_ID PATIENT_ID ADMISSION_ EXP ADMITTED_BY WAR DISCHARGE_
------------ ---------- ---------- --- ----------- --- ----------
         205        101 02/02/2011 HB          114 P   16/02/2011
         275        101 01/09/2010 HY          115 L   01/11/2010
         286        101 03/05/2016 AR          116 A   03/07/2016
         303        101 03/04/2018 LA          125 F   13/05/2018
         298        103 23/01/2016 TS          114 L   24/04/2016
         299        103 23/03/2016 AP          114 L   23/04/2016
         305        103 23/04/2018 HT          125 F   29/05/2018
         321        103 13/05/2018 AR          125 F   23/05/2018
         283        105 03/12/2015 AR          116 A   05/12/2015
         278        105 01/01/2011 HB          115 P   30/01/2011
         307        105 03/04/2018 TS          125 F   13/05/2018
Littlefoot
  • 131,892
  • 15
  • 35
  • 57

1 Answers1

0

In Oracle, you can simply subtract two dates and get the difference in days.

Similar question: DATEDIFF function in Oracle

Rima
  • 1,447
  • 1
  • 6
  • 12
  • i tried but it didn't work tho.. also could it be done only for 1 particular record but not a list of records? thanks! – Clarissa Teng Apr 27 '19 at 09:43
  • What do you mean by saying that "it didn't work"? Consider posting table description, as well as code you wrote (the one that *didn't work*). – Littlefoot Apr 27 '19 at 11:05