Thats why I say I have never done it.
>Aye, thanks. I've been experimenting along the lines of the 1st suggestion.
>I've been OK in the past with sub-query clauses but I can't get my head around how it would work here.
>
>>Hm, I see two ways. The one is two separate SELECTs. Use the one to sum the one and use the result in the second.
>>
>>The other one (what I not fully understand and never have used) is a subquery in the way
>>
>>SELECT;
>>Cursor1.fieldXXX,;
>>(Select sum(blabla) from cursor2 where cursor2.field=cursor1.field) as nAggr;
>>from Cursor1
>>
>>
>>>I'm trying to achieve the report below:
>>>
>>>
>>> Derek Bob Angus ...
>>>Inv. No. Booked Charged Booked Charged Booked Charged
>>>_____ ______ _______ ______ _______ ______ _______
>>>1 0.75 0.75
>>>2 6 5.5 12 11
>>>3 20.5 20.5
>>>...
>>>
>>>
>>>So I need to sum the hours worked on a job, under each invoice ID, for each employee (JobAct.Hours), versus the hours required for each (JobHeads.Quantity)
>>>
>>>First I'm getting "command contains unrecognised phrase/keyword" and I can't figure what's up.
>>>
>>>Here's my pathetic attempt at the SQL. I've come to realise that I could really do with a course on this. I can't tell how successful it is as it won't work but I'm sure it's no good.
>>>
>>>
>>>Select JobAct.OurInvID, JobHeads.JobID, JobHeads.LabourID, ;
>>> SUM( jobheads.Quantity) as Booked, SUM( jobact.hours) as Charged, ;
>>> Labour.Text ;
>>> from jobheads ;
>>> Where jobheads.JobID = "RTvo" ;
>>> and not EMPTY( JobAct.OurInvID) ;
>>> INNER JOIN JobAct ;
>>> ON jobheads.JobID = jobact.JobID ;
>>> INNER JOIN Labour ;
>>> ON Jobheads.LabourID = Labour.ID ;
>>> group by JobAct.OurInvID, jobheads.JobID, JobHeads.LabourID ,Labour.Text ;
>>> order by JobAct.OurInvID, jobheads.JobID, JobHeads.LabourID ;
>>> into cursor JobsS
>>>
>>>
>>>A help would be much appreciated.
>>>
>>>Terry
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]