Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 To: Ryan Lashway
  Where is Ryan Lashway?
 Warrensburg
 New York - United States
 Ryan Lashway
 Tags
Subject: RE: Combind Records
Thread ID: 202104 Message ID: 202111 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Thursday, November 06, 2008 1:14:45 AM         
   


> When I try either suggestion I get a "SQL:GROUP BY clause is missing ot invalid.
>
>
>
> >
> >
select account, max(adress) as address, ;
> >  sum(item1) as item1, ;
> >  sum(item2) as item1, ;
> >  sum(total) as total ;
> >  from myTable ;
> >  group by 1

> >
> > Cetin Basoz
>
>
>
> Ryan J. Lashway
> http://www.lashtech.com

Try this (based on your sample):

Create Cursor junk (acctno c(10), address c(1), item1 N(1),item2 N(1), Total N(2))
Insert Into junk Values ("7077","a",5,0,5)
Insert Into junk Values ("7077","a",0,5,5)
Insert Into junk Values ("7075","a",3,5,5)
Insert Into junk Values ("7075","a",0,6,5)
Insert Into junk Values ("7077","a",4,5,5)

Select acctno, address, Cast(Sum(item1) As N(12,2)) As item1,;
	CAST(Sum(item2) As N(12,2)) As item2,;
	CAST(Sum(Total) As N(12,2)) As Total;
	FROM junk Group By acctno, address


Maybe there are more fields than the one you showed above, try adding some of those fields in the group by clause.

Jun Tangunan
http://weblogs.foxite.com/sandstorm36/



COMPLETE THREAD
Combind Records Posted by Ryan Lashway @ 11/5/2008 11:34:59 PM
RE: Combind Records Posted by Jun Tangunan @ 11/5/2008 11:51:12 PM
RE: Combind Records Posted by Cetin Basoz @ 11/5/2008 11:52:28 PM
RE: Combind Records Posted by Ryan Lashway @ 11/6/2008 12:40:27 AM
RE: Combind Records Posted by Jun Tangunan @ 11/6/2008 1:14:45 AM
RE: Combind Records Posted by Ryan Lashway @ 11/6/2008 2:30:00 PM
RE: Combind Records Posted by Anders Altberg @ 11/6/2008 2:53:08 PM
RE: Combind Records Posted by Ryan Lashway @ 11/6/2008 3:33:33 PM
RE: Combind Records Posted by tushar @ 11/6/2008 4:05:25 PM
RE: Combind Records Posted by Anders Altberg @ 11/6/2008 5:09:32 PM
RE: Combind Records Posted by Ryan Lashway @ 11/6/2008 8:33:13 PM
RE: Combind Records Posted by Anders Altberg @ 11/6/2008 10:39:35 PM
RE: Combind Records Posted by Cetin Basoz @ 11/6/2008 4:06:22 PM
RE: Combind Records Posted by Mike Yearwood @ 11/6/2008 3:21:48 PM
RE: Combind Records Posted by Ryan Lashway @ 11/6/2008 9:36:42 PM