Subject | Re: [ib-support] Group by behavior |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2002-10-25T10:58:15Z |
At 10:15 25.10.2002 +0200, you wrote:
think) which is (or at least was) impossible. So this is how you do it if
you want to avoid a syntax error (well, after you correct my spelling
mistakes):
select distinct d.PlannedAssessor,
(select count(*) from DAR d2
inner join ACCIDENTCLAIMPROCESS a on d2.darno=a.darno
where d2.plannedAssessor <> a.assessor AND d2.plannedAssessor =
d.plannedAssessor) AS DidNotMakeAppointMent,
(select count(distinct d4.darno) from DAR d4
where d4.PlannedAssessor = d.PlannedAssessor) as AssessmentCount,
(select count(*)
from DAR d3 inner join ACCIDENTCLAIMPROCESS a2 on d3.darno=a2.darno
where d3.Assessor_DT > a2.ASSESSMENTDATE and
d3.plannedAssessor=d.plannedAssessor) AS UnknownColumnName
FROM DAR d
HTH,
Set
>Sure, but only through subselects, i.e.Oops, sorry, forgot that the subselects also have to be in the group by (I
think) which is (or at least was) impossible. So this is how you do it if
you want to avoid a syntax error (well, after you correct my spelling
mistakes):
select distinct d.PlannedAssessor,
(select count(*) from DAR d2
inner join ACCIDENTCLAIMPROCESS a on d2.darno=a.darno
where d2.plannedAssessor <> a.assessor AND d2.plannedAssessor =
d.plannedAssessor) AS DidNotMakeAppointMent,
(select count(distinct d4.darno) from DAR d4
where d4.PlannedAssessor = d.PlannedAssessor) as AssessmentCount,
(select count(*)
from DAR d3 inner join ACCIDENTCLAIMPROCESS a2 on d3.darno=a2.darno
where d3.Assessor_DT > a2.ASSESSMENTDATE and
d3.plannedAssessor=d.plannedAssessor) AS UnknownColumnName
FROM DAR d
HTH,
Set