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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ANSI Looking for Overlaps in timestamps or range

Status
Not open for further replies.

SuperSqlr

Programmer
Apr 13, 2004
6
US
I have a problem that is easy for you and way hard for me. I am triing to look for overlaps in timestamps. Basically I have concatenated a start_date and Start_time, column and I need to set a range to the End_date and End_time column. Then I will be able to look for procedures that are overlapping. I am way out of my league here but if I can get the range parameter set through a timestamp or other then I am set to finish this problem.

Thanks...
 
Not quite following what you are trying to do hear. Could you explain a bit further an maybe give an example?

Thanks

J. Kusch
 
I sort of figured it out but take a look please.
I have a table and it has 6 columns.
Procedure_id, Doctor, Start_date, Start_time, End_date, End_time...
So what I was asking is how to alias a timestamp so I can determine the procedures that overlap. So if a procedure overlaps another it can be reviewed against a procedural success/failure table.

Here is what I came up with...
Basically the way I solved this was by aliasing the same table and then setting timestamp alias for start and stop...

SELECT a.proc_id, Count (a.proc_id), a.anest
FROM anest_procedures AS a,
anest_procedures AS b
WHERE (CAST (a.start_date || ' ' || a.start_time AS TimeStamp), CAST (a.end_date || ' ' || a.end_time AS TimeStamp))
OVERLAPS (CAST (b.start_date || ' ' || b.start_time AS TimeStamp), CAST (b.end_date || ' ' || b.end_time AS TimeStamp))
AND
b.anest = a.anest
GROUP BY a.proc_id, a.anest
ORDER BY a.proc_id;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top