Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Suresh Adhikari
  Where is Suresh Adhikari?
 New Delhi
 India
 Suresh Adhikari
 To: Bhavbhuti Nathwani
  Where is Bhavbhuti Nathwani?
 Rajkot
 India
 Bhavbhuti Nathwani
 Tags
Subject: RE: Invalid GROUP BY - at my wits end
Thread ID: 289125 Message ID: 289141 # Views: 38 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Tuesday, December 28, 2010 5:20:26 PM         
   


See, if this works,

SELECT iPID ;
, iGID ;
, iOrder ;
, tDt ;
, iAcctID ;
, bDebit ;
, bCredit ;
, cSource ;
, cDocBk ;
, iDocNo ;
, tDocDt ;
, iDocAcctID ;
, iOSAcctID ;
, SUM(bAdjDebit) AS bAdjDebit ;
, SUM(bAdjCredit) AS bAdjCredit ;
FROM curLedger;
WHERE IIF(bDebit > 0, bDebit <> bAdjDebit, IIF(bCredit > 0, bCredit <> bAdjCredit, .T.)) ;
AND cSource <> 'C' ;
GROUP BY iPID ;
, iGID ;
, iOrder ;
, tDt ;
, iAcctID ;
, bDebit ;
, bCredit ;
, cSource ;
, cDocBk ;
, iDocNo ;
, tDocDt ;
, iDocAcctID ;
, iOSAcctID ;
INTO CURSOR curOSAccount

mNarration removed from Select clause because it is not a part of GROUP BY clause

From VFP9 Help:
The GROUP BY clause specifies one or more columns used to group rows returned by the query. Columns referenced in the SQL SELECT statement list, except for aggregate expressions, must be included in the GROUP BY clause. You cannot group by Memo, General, or Blob fields.

ENTIRE THREAD

Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/28/2010 2:59:24 PM
RE: Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/28/2010 3:09:19 PM
RE: Invalid GROUP BY - at my wits end Posted by tushar @ 12/28/2010 3:14:20 PM
RE: Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/28/2010 3:21:25 PM
RE: Invalid GROUP BY - at my wits end Posted by tushar @ 12/28/2010 3:33:31 PM
RE: Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/28/2010 5:18:06 PM
RE: Invalid GROUP BY - at my wits end Posted by Anders Altberg @ 12/28/2010 6:21:27 PM
RE: Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/29/2010 6:15:51 AM
RE: Invalid GROUP BY - at my wits end Posted by Anders Altberg @ 12/29/2010 5:25:35 PM
RE: Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/29/2010 5:30:20 PM
RE: Invalid GROUP BY - at my wits end Posted by Suresh Adhikari @ 12/28/2010 5:20:26 PM
RE: Invalid GROUP BY - at my wits end Posted by Bhavbhuti Nathwani @ 12/28/2010 5:31:21 PM