title: Visual FoxPro query add total
body: <p>I have the follwoing simple query which just SUMS the total of 1 or more rows. Based on a unique reference.</p>
  
  <p>What I want to do is add a total column to the results of the jobcharge.nAccrInv grouped by JobRef</p>
  
  <p>I.e</p>
  
  <p>Job_Ref / Name / Sales / Total </p>
  
  <p>123 / VAT / 10.0</p>
  
  <p>123 / DUTY / 10.0</p>
  
  <p>123 / GHC / 10.0 / 30.0</p>
  
  <p>SELECT DISTINCT ;</p>
  
  <pre><code>Job.cJobRef AS JobRef,;
  Job.cName AS Customer_Name, ;
  Job.cJobType AS JobType, ;
  Job.cJobMode AS JobMode, ;
  Job.cOrigin AS Org,;
  Job.cDestination AS Dest,;
  Job.cOwner AS Owner,;
  jobcharge.cInvoiceDescr as [Invoice_Desc], ;
  jobcharge.nAccrInv as [Accrued_Costs], ;
  jobcharge.nCostInv as [Actual_Costs], ;
  jobcharge.nSaleInv as [Sales], ;
  ( SELECT SUM(jobcharge.nAccrInv) AS SalesTotals FROM jobcharge WHERE NJOBID =3524); FROM job;INNER JOIN jobcharge ON job.nJob_Id = jobcharge.nJobId; WHERE job.cJobRef= "RSJC00001" AND job.cOwner = 'DBQ'
  </code></pre>
  
  <p>Thanks Ross</p>