Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Patrick Danso
  Where is Patrick Danso?
 Accra
 Ghana
 Patrick Danso
 Tags
Subject: RE: Append Records to Another Table
Thread ID: 345245 Message ID: 345265 # Views: 25 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, May 21, 2012 8:59:47 PM         
   


> >
> > Does it matter which date is saved? What happened to Peter?
> >
> > ZAP IN Rpay
> >
INSERT INTO Rpay (memberid, date, name) SELECT memberid, MIN(date),name FROM Payments GROUP BY memberid,name

> > -Anders
>
> Hi Anders,
> I have this error message : Group BY clause is missing or invalid
> thanks

No error at my end:

CREATE CURSOR Payments(MemberID c(4), date D, Name C(10))
TEXT NOSHOW TO lcText
0001 01/01/12 Hook
0052 01/01/12 James
0003 13/02/12 Fred
0001 23/02/12 Hook
0011 25/02/12 Pat
0052 13/03/12 Peter
ENDTEXT 
STRTOFILE(m.lcText,'Payments.txt')
SET DATE DMY 
APPEND FROM payments.txt DELIMITED WITH BLANK 
CREATE CURSOR Rpay (MemberID c(4), date D, Name C(10))
INSERT INTO Rpay (memberid, date, name) SELECT memberid, MIN(date),name FROM Payments GROUP BY memberid,name
BROWSE LAST NOWAIT 

-Anders

PS The error byou got sounds likev you have added more columns.
Those would have to be included in the GROUP BY columns too.

-A

ENTIRE THREAD

Append Records to Another Table Posted by Patrick Danso @ 5/21/2012 11:44:25 AM
RE: Append Records to Another Table Posted by Anders Altberg @ 5/21/2012 12:10:51 PM
RE: Append Records to Another Table Posted by Patrick Danso @ 5/21/2012 6:40:21 PM
RE: Append Records to Another Table Posted by Patrick Danso @ 5/21/2012 7:37:06 PM
RE: Append Records to Another Table Posted by Anders Altberg @ 5/21/2012 8:59:47 PM