SQL Error

SQL Error

Post by Jonas Wi » Thu, 03 Jul 2003 03:08:58


When I run my program I get the error:

When Group By Exists, every simple field in projectors must be in group by.

My SQL look like this:

tblSQLRpt.SQL.Clear;
tblSQLRpt.SQL.Add('SELECT tInventoryLedgerSalesList.ItemID, ' +
'tInventoryItemList.ItemName, ' +
'tInventoryLedgerSalesList.FacilityID, ' +
'tInventoryLedger.EntryDateTime, ' +
'SUM(tInventoryLedgerSalesList.SalesQty), ' +
'SUM(tInventoryLedgerSalesList.SalesAmt) ' +
'FROM tInventoryLedgerSalesList, ' +
'tInventoryItemList, ' +
'tInventoryLedger ' +
'WHERE (tInventoryLedgerSalesList.LedgerID =
tInventoryLedger.LedgerID) ' +
'AND (tInventoryLedgerSalesList.ItemID =
tInventoryItemList.ItemID) ' +
'AND (tInventoryLedgerSalesList.FacilityID =
tInventoryItemList.FacilityID) ' +
'AND (tInventoryLedgerSalesList.FacilityID >= '
+ FacilityFrom + ') ' +
'AND (tInventoryLedgerSalesList.FacilityID <= '
+ FacilityTo + ') ' +
'AND (tInventoryLedger.DateTime >= "' +
DateToStr(FromDate) + '") ' +
'AND (tInventoryLedger.DateTime <= "' +
DateToStr(ToDate) + ' 11:59:59 PM") ' +
'GROUP BY ItemID, ' +
'ItemName, ' +
'FacilityID ' +
'ORDER BY ' + OrderBy);
tblSQLRpt.Open;

Any ideas to why i get this?

J
 
 
 

SQL Error

Post by Richard Bi » Thu, 03 Jul 2003 03:15:59

Change this:


to this:


Richard



by.