Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find person with longest name
Message
De
21/03/2018 12:59:42
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:
01658909
Vues:
126
>>>>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
>
You could do

replace note1 with fromTable.note1 for seek(thisId, "fromTable")

or some kind of update statement, which I'm not sure I can write correctly from the top of my head, something like

update toTable set note1=fromTable.note1 from fromTable where toTable.thisId = fromTable.thisId

(probably won't work but that's what I'd start with).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform