Try
SELECT Person.lname, Person.totassignhrs, SUM(Pinfo.totcomphrs),;
Person.failcmpldate;
FROM workprog!person INNER JOIN workprog!pinfo ;
ON Person.personid = Pinfo.personid;
WHERE NOT (Person.compstatus == "COMPLETE");
<b>HAVING</b> SUM(Pinfo.totcomphrs) = Person.totassignhrs
>I have a one to many table
>
>first table is call person (one)
>lastname
>totassignhrs
>compstatus
>
>second table is called pinfo (many)
>totcomphrs
>
>
>What I am trying to do is write a query where compstatus is not == "COMPLETE" and the sum of totcomphrs (from many table) equals totassignhrs.
>
>The following query give me syntax error saying sum.prg does not exist:
>
>SELECT Person.lname, Person.totassignhrs, SUM(Pinfo.totcomphrs),;
> Person.failcmpldate;
> FROM workprog!person INNER JOIN workprog!pinfo ;
> ON Person.personid = Pinfo.personid;
> WHERE NOT (Person.compstatus == "COMPLETE");
> AND SUM(Pinfo.totcomphrs) = Person.totassignhrs
>
>I'm I writing this query wrong or is there another way to write this.
>
>Thanks
>Nick Patel
--sb--