Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calculate a date range

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
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
 
Just imagine that you have 2 different tables with the same content: use aliases

select a.smth1-b.smth2 from your_table a, your_table b
where a.smth3 = b.smth3 and ...
 
thanks, I never would have thought of that..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top