Subject | Group by behavior |
---|---|
Author | Gerhardus Geldenhuis |
Post date | 2002-10-24T11:11:58Z |
Hi
I have the following query
select
d.Darno,
d.PlannedAssessor,
a.Assessor,
d.Assessor_DT,
a.AssesmentDate
from DAR d inner join ACCIDENTCLAIMPROCESS a on d.darno=a.darno
order by d.plannedassessor
I want the query to group by d.plannedassesor but I get a invalid column
reference error. I have looked at the examples in the Embedded SQL Guide
but I can't see any difference between how group by is used there and
how I use it.( I suspect I dont fully understand the functioning of
group by yet)
What I also want to do with the group by is have a count on
d.plannedassesor.
Would it be possible to have something like a
count(d.Assessor_DT < a.AssesmentDate) and a
count(d.PlannedAssessor <> a.Assessor)
There will never be any null values present in any of the fields.
Here is some typical data.
DARNO PLANNEDASSESSOR ASSESSOR_DT
------------------------------------------
DAR0004 Emil Besuidenhout 2002/10/24
DAR0001 Gerhardus Geldenhuis 2002/10/23
DAR0006 Gerhardus Geldenhuis 2002/10/24
DAR0007 Gerhardus Geldenhuis 2002/10/30
DAR0003 Gerrit Bonnetti 2002/10/24
DAR0008 Gerrit Bonnetti 2002/10/29
DAR0002 Willie de Lange 2002/10/25
DAR0005 Willie de Lange 2002/10/24
I could build this query using a procedure fairly easily but doing it in
a query if possible would be much better.
Any help appreciated.
Groete
Gerhardus
I have the following query
select
d.Darno,
d.PlannedAssessor,
a.Assessor,
d.Assessor_DT,
a.AssesmentDate
from DAR d inner join ACCIDENTCLAIMPROCESS a on d.darno=a.darno
order by d.plannedassessor
I want the query to group by d.plannedassesor but I get a invalid column
reference error. I have looked at the examples in the Embedded SQL Guide
but I can't see any difference between how group by is used there and
how I use it.( I suspect I dont fully understand the functioning of
group by yet)
What I also want to do with the group by is have a count on
d.plannedassesor.
Would it be possible to have something like a
count(d.Assessor_DT < a.AssesmentDate) and a
count(d.PlannedAssessor <> a.Assessor)
There will never be any null values present in any of the fields.
Here is some typical data.
DARNO PLANNEDASSESSOR ASSESSOR_DT
------------------------------------------
DAR0004 Emil Besuidenhout 2002/10/24
DAR0001 Gerhardus Geldenhuis 2002/10/23
DAR0006 Gerhardus Geldenhuis 2002/10/24
DAR0007 Gerhardus Geldenhuis 2002/10/30
DAR0003 Gerrit Bonnetti 2002/10/24
DAR0008 Gerrit Bonnetti 2002/10/29
DAR0002 Willie de Lange 2002/10/25
DAR0005 Willie de Lange 2002/10/24
I could build this query using a procedure fairly easily but doing it in
a query if possible would be much better.
Any help appreciated.
Groete
Gerhardus