Re: Create one record from multiple records
- From: Bernhard Sander <fuchs@xxxxxxx>
- Date: Wed, 30 Aug 2006 20:35:18 +0200
Hi Arvin,
Hi everyone. Can someone please give me some pointers on how to
accomplish this task? I have one table with multiple records. Looks
kind of like this:
------------------------------------------------------------------------------------------------------------------
Cust_ID Name Charge Date
1000 XXXXXXXXXX 536.10 06/01/00
1352 XXXXXXXXXX 204.19 07/13/00
1000 XXXXXXXXXX 1055.42 08/15/00
1352 XXXXXXXXXX 978.11 09/14/00
------------------------------------------------------------------------------------------------------------------
What I need to do here is take all of the cust_id's that are the same
(the cust_ID field has multiple entries, just different charges and
dates), add the sum of the charges for a given year (for this example,
dates from 01/01/00 to 12/31/00) and insert the added total into a new
dbf file as one record. For the example above:
------------------------------------------------------------------------------------------------------------------
Cust_ID Name Total Charges Year
1000 XXXXXXXXXX 1591.52 00
1352 XXXXXXXXXX 1182.30 00
-----------------------------------------------------------------------------------------------------------------
Can someone tell me what would be the easiest way to get this done?
There are about 95,xxx records in this table.
SELECT cust_id, name, sum(charge) as charges, year(date) as year ;
FROM table ;
INTO TABLE sumtable ;
GROUP BY cust_id, name, 4
Regards
Bernhard Sander
.
- Follow-Ups:
- Re: Create one record from multiple records
- From: wickedbusa
- Re: Create one record from multiple records
- References:
- Create one record from multiple records
- From: wickedbusa
- Create one record from multiple records
- Prev by Date: Create one record from multiple records
- Next by Date: Re: Damaged/Corrupted DBF
- Previous by thread: Create one record from multiple records
- Next by thread: Re: Create one record from multiple records
- Index(es):
Relevant Pages
|