markmorgan
Programmer
In DB2 are subselects allowed in a select expression e.g.
select CourseCode, EventCode,
(SELECT Count(*) FROM CrseApplic CA
WHERE CA.CourseCode = CE.CourseCode
AND CA.EventCode = CE.EventCode
AND CA.CrsAppCancelledDt IS NULL) AS EventEnrolCount
from CrseEvent CE
where CourseCode = ?
order by CourseCode, EventCode
This works fine for me under Siemens SESAM (SQL99 standard), but not under MicroFocus XDB emulating DB2v6. I have checked the DB2 manuals, but it is not clear wether this is allowed or not and I don't have access to DB2 to try it.
I will also mail this direct to MicroFocus to see if it is a compatibility issue.
Mark.
select CourseCode, EventCode,
(SELECT Count(*) FROM CrseApplic CA
WHERE CA.CourseCode = CE.CourseCode
AND CA.EventCode = CE.EventCode
AND CA.CrsAppCancelledDt IS NULL) AS EventEnrolCount
from CrseEvent CE
where CourseCode = ?
order by CourseCode, EventCode
This works fine for me under Siemens SESAM (SQL99 standard), but not under MicroFocus XDB emulating DB2v6. I have checked the DB2 manuals, but it is not clear wether this is allowed or not and I don't have access to DB2 to try it.
I will also mail this direct to MicroFocus to see if it is a compatibility issue.
Mark.