You don't get the newer enhanced UPDATE-SQL statement as service pack, it's not a bug of VFP6, but simply a lack of the capability of that older SQL engine. This is the kind of progress developers want paid, it's not just a bugfix, it's the enhancement of possibilities, so such enhancements of VFP7,8,9 cost something, of course. SQL is not something ever complete like the four base arithemtic operations and even having a calculator showing +,-,x and ÷ buttons you still have quality differences in the range of values and precison it can operate on, performance, other operations,.... You may think of SQL as even only having three base operations INSERT, UPDATE, and DELETE, but there's much more to it and complexity grows with the possibilities of subqueries and other details.
As owner of VFP6 you can get the cheaper update price not only for VFP7, but also of VFP9, if you could still buy VFP9. You may find some remaining stock or used versions somewhere. From MS you may only get it through some subscriptions.
My code is similar to Griffs, yes, but it doesn't sort by ID descending, it sorts reverse of the physical order of the file, which from your sample data would not be sorted by ID.
If you have any record after querying [tt]SELECT ID, COUNT(DISTINCT group) FROM yourTable GROUP BY ID WHERE !EMPTY(group) HAVING COUNT(group)>1[/tt], then both Mikes and Griffs code will write a wrong group codes to one of the groups having that ID. I assume that is the case, as group with just three characters has less possible values than the number of IDs you have there. You'll fill up gaps wrongly. Mikes and Griffs code assume any group code only occurs with the same ID, I don't think so, as there are much more IDs (range just below a million) than possible group codes (2600). As your table only has 5000 records, that might not be the case, but it's worth to test, if you don't mingle two groups.
As an example:
Code:
CREATE CURSOR yourTable (id i, group c(4))
INSERT INTO yourTable Values(987691,'')
INSERT INTO yourTable Values(987691,'G99')
INSERT INTO yourTable Values(987691,'G99')
INSERT INTO yourTable Values(654230,'')
INSERT INTO yourTable Values(654230,'G233')
INSERT INTO yourTable Values(888765,'')
INSERT INTO yourTable Values(888765,'H91')
*...
INSERT INTO yourTable Values(987691,'')
INSERT INTO yourTable Values(987691,'Z23')
INSERT INTO yourTable Values(987691,'Z23')
SELECT ID, COUNT(DISTINCT group) FROM yourTable GROUP BY ID WHERE !EMPTY(group) HAVING COUNT(DISTINCT group)>1
It might again fail on VFP6s missing sql capabilities needed here, ie the COUNT(DISTINCT field).
Bye, Olaf.