Hi Tom,
what do you want to have as a result if your datas are 1 A 10 1 B 20 1 A 30
If you want 1 A 40 1 B 20 you can write SELECT stock_id, location, SUM(quantity) as mysum FROM mytable GROUP BY stock_id, location INTO .... but in this case (and except with VFP) you can't have a 'quantity' field in the result.
If you want as a result 1 A 10 40 1 B 20 20 1 A 30 40 (so in each line of your table you have the total number of the current id in the location) you can write SELECT stock_id, location, quantity, (SELECT SUM(quantity) FROM mytable s WHERE m.stock_id = s.stock_id AND m.location = s.location) as mysum FROM mytable m INTO ....
Note : I haven't check syntax so may be you must adjust the command !
Is this help ? The foxil