Code:
SELECT bca_invoice.InvoiceID,BillingAddrID,bca_invoice.OrderNum,bca_invoice.DateAdded,Balance,bca_invoice.ClientVendorID,ServiceID,bca_invoice.TermID,bca_term.Days, c.Email , DATEDIFF('d',(DateADD('d',bca_term.Days,bca_invoice.DateAdded)) ,Date()) FROM  (bca_invoice LEFT JOIN bca_term ON (bca_invoice.TermID = bca_term.TermID)) INNER JOIN bca_clientvendor c ON  ( bca_invoice.ClientVendorID = c.ClientVendorID )  WHERE c.status = 'N'  AND ( ( ( (bca_invoice.InvoiceTypeID) In (1,12)  AND  (DateADD('d',bca_term.Days,bca_invoice.DateAdded) < Date()))AND bca_invoice.TermID<> 117  )   ) AND Total<>0 AND bca_invoice.IsPaymentCompleted=false AND bca_invoice.invoiceStatus=0  AND bca_invoice.CompanyID = 12 AND bca_invoice.InvoiceID<>-1  AND bca_invoice.DateAdded<= # 03-11-2010 #  ORDER BY bca_invoice.OrderNum, bca_invoice.INVOICEID DESC
I am trying to execute this query from java program, but it throws the exception indicating

[Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that does not include the specified expression 'INVOICEID' as part of an aggregate function.


But when i execute it in access sql editor then it executed fine with no problem.

Please let me know where is problem... ?