>SELECT count( DISTINCT person.lname), ; > sum(pinfo.workhour) > FROM Person INNER JOIN Pinfo ON person.personid = pinfo.personid ; > WHERE person.personid IN (1,2) ; >Hi Naomi, long time no talk. I tried the sample above and it gave me result for only one person (The first person work hours from pinfo actually). Also can the where clause be expanded further to include more filtering, When I added more items to WHERE clause, I got zero results:
SELECT count( DISTINCT person.lname), sum(pinfo.workhour) ; FROM Person INNER JOIN Pinfo ON person.personid = pinfo.personid ; WHERE person.personid IN (1,2) AND Person.personid = 3054 ; and person.personid = 3151In reality, what I am trying to do is combine 2 queries into one.
SELECT COUNT(Person.fname); FROM workprog!person ; WHERE Person.startdate >= .txtFromdate.value; AND Person.startdate <= .txtTodate.value; AND upper(Person.court) = "R"; AND upper(Person.sex) = 'M' ; OR (Person.startdate >= .txtFromdate.value; AND Person.startdate <= .txtTodate.value; AND upper(Person.court) = "J") ; AND upper(Person.sex) = 'M' ; into cursor personcounthere is query 2 getting sum from child record
SELECT sum(Pinfo.workhour) AS WorkhourSum; FROM workprog!person inner join workprog!pinfo ON person.personid = pinfo.personid; WHERE Person.startdate >= .txtFromdate.value; AND Person.startdate <= .txtTodate.value; AND upper(Person.court) = "R"; AND upper(Person.sex) = 'M' ; OR (Person.startdate >= .txtFromdate.value; AND Person.startdate <= .txtTodate.value; AND upper(Person.court) = "J") ; AND upper(Person.sex) = 'M' ; into cursor wrksumI want to combine these two queries so that the results will show the number of people from person table (COUNT(Person.fname) and sum(Pinfo.workhour) AS WorkhourSum. This is probably not doable, but I thought I would consult with the foremost experts on UT. Thanks for your assist Naomi.