Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Something about grouping data
Message
From
22/04/1999 13:09:05
 
 
To
22/04/1999 12:42:47
Jacky Yuen
Myth Group Computer Technology
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00211104
Message ID:
00211131
Views:
40
>Hi ,
> Sorry for asking stupid question again ~_~
> I wanna group some data :
> 1 : 000001
> 2 : 000001
> 3 : 000003
> 4 : 000004
> 5 : 000003
>
> and get a result like that :
> 1 : 000001
> 2 : 000003
> 3 : 000004
>
>Yeah ,as you know ,remove the data if there is already exist
>I wanna use for-loop and array to do that ,but it is zero efficiency ,I think .
>
>Any idea ?
>

You can USE SELECT DISTINCT... or a GROUP BY clause in a SQL Select statement to get the unique values:

If you have a table INVLINES (INVNO, INVAMT), you could:

SELECT DISTINCT INVNO FROM INVLINES TO CURSOR UNIQINVS

to just get the unique InvNo values, or

SELECT INVNO, SUM(INVAMT) AS INVAMTTOT FROM INVLINES GROUP BY INVNO

to get the unique InvNo along with the sum of theInvAmts from the matching records.

>Thanx for help ~ ^^
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform