You must include
invoice.nInvoiceNumber, invoice.dInvoiceDate
in the GROUP BY. I'd hope nInvoiceNumber is the same for all records with the same Invoice.nID, so you should be able to drop Invoice.nID from the GROUP BY.
>Maybe I am just being brain dead today, but I upgraded to VFP 8, and cannot get the following SELECT to work. I am getting a GROUP BY clause error and have read past messages and Microsoft's site but I still cannot get it!!!
>
>I have even tried the View Designer and I get the same error message.
>
>
>SELECT invoice.nInvoiceNumber, invoice.dInvoiceDate,
>SUM(invoicedetail.nQuantity*invoicedetail.nUnitPrice) AS nTotal
>FROM Invoice, InvoiceDetail
>WHERE Invoice.nID = InvoiceDetail.nParentID
>GROUP BY Invoice.nID Order BY invoice.nID
>
>
>What is wrong???????? I know I can bypass the problem with the SET ENGINEBEHAVIOUR 70, but I would really like to know what the correct syntax should be.
>
>TIA