SQL Server to Informix Question
Posted in 2003
Good
afternoon everyone,
Thanks to everyone for responding to my previous "SQL Server to Informix"
question. We have one remaining issue that we can't seem to figure out.
Again, this is a stored procedure. The pertinent original SQL Server SQL
is:
Select distinct CH.CalloutId, count (distinct CAH.LogDate), count
(distinct CBH.LogDate)
from CalloutHistory CH, Callout CA, CalloutHistory CAH
where ...
... group by CH.CalloutId;
Would the equivalent in Informix be:
select distinct (CH.CalloutId, count(CAH.LogDate),
count(CBH.LogDate))
from CalloutHistory CH, Callout CA, CalloutHistory CAH
where ...
... group by CH.CalloutId;
Another solution we were thinking of was to nest several foreach's or
perhaps use a temp table, but the where condition is rather nasty with "left
outer joins", several levels of subqueries, etc. Trying to untangle the
logic and divide it up into each foreach or into temp tables would be
extremely difficult, if at all possible.
I assume this is failing because Informix doesn't want to see more than one
distinct (or unique) in the same select list.
Any help would be greatly appreciated.
Thanks
Rob Schmitz
Rob.B.Schmitz@mail.sprint.com