I have a database, a patient/hospital type application. There is a "movement table" that has the date and time of the movement and the movement type - for admission this type would be ADM. When the patient leaves another record is added to the same table with the appropriate date and time but the movement type is now REL for released. I need to calculate the time between these two records. If they were coming from two separate tables I wouldnt have any problem, but how can I select the matching ADM and REL movements for the patient... especially if they have multiple admissions, how can I calculate the time between the ADM and the REL...???
thanks for any suggestions
thanks for any suggestions