I have this query to retun the results froma single table with six columns...They are Proc_id,anest,start_time,start_date,end_time,end_time...
This is returning all procedures that overlap by setting a timestamp and InnerJoin to compare those that overlap. I am triing to return the Max procedures that overlap, but when I use a select max (the query) As whatever FROM anest_procedures; It won't run, I am using Postgres(PGAdminIII).Thanks in advanced...
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;
This is returning all procedures that overlap by setting a timestamp and InnerJoin to compare those that overlap. I am triing to return the Max procedures that overlap, but when I use a select max (the query) As whatever FROM anest_procedures; It won't run, I am using Postgres(PGAdminIII).Thanks in advanced...
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;