Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find person with longest name
Message
 
À
21/03/2018 04:14:53
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01658805
Message ID:
01658906
Vues:
52
>>>But I can't figure out what count(ID) is doing, how to return the number of rows per ID, or how to limit my results
>>>to the rows that have the longest names?
>
>Use a shortened copy of the field cast into a char(200) or varchar as the group by and then join the result with the original. Can't remember a better workaround. Assume that all the names you have are such that if characters beyond 200 are different it doesn't mean it's a different person.

Sometimes, the first 200 characters won't be enough to differentiate a newly updated memo from one recently edited. This solution seems to work, although since I had never used scan, I am sure I did it correctly? And if there is a way to do this with SQL, I would be very happy to know of it.
alter table toTable add column note1 memo 
&& make sure this field does not already exist, using a procedure for this purpose.
USE fromTable IN 0  
SELECT fromTable
INDEX on thisID UNIQUE TO indexID  && the key field
SELECT fromTable &&  the memo field is in this table
SCAN
	findThisID = thisID
	SELECT toTable  && insert the memo field in this table
	IF SEEK(findThisID)
		REPLACE note1 WITH fromTable.note1  
                && all other rows/fields are unique as a result of using a select distianct * ... into table toTable
                && but the memo field is missing.  So, find the key field and its memo in the fromTable
                && then insert the memo into the toTable.
	endif
ENDSCAN
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform