>>I like the Select-SQL solution, I think it should be the fastest. I slightly adjusted the solution #1. Don't use number 3 with ORDER. The table should not have any order set for SCAN FOR.
>
>One thought though,
>If the SQL is not optimizable, then pure xBase commands are faster :-)
>I love SQL but...
We have index on the main field, so it's partially optimizable in this case (because of SET DELETED ON). You can not optimize GROUP BY.
I'm not sure how the index works exactly. We may have an index with FOR clause, e.g.
index on myField FOR !DELETED() Then this index could be used in SQL as well, if I recall correctly.
If it's not broken, fix it until it is.
My Blog