Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL GROUP BY with MEMO-Field in Fieldlist
Message
De
16/11/2013 07:48:41
Thomas Ganss (En ligne)
Main Trend
Frankfurt, Allemagne
 
 
À
16/11/2013 03:22:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01587998
Message ID:
01588144
Vues:
44
Just the relevant parts as SWAG to give you an idea :

Select F1, F2, F3, F4, Sys(YouhavetoLookupTheNoAsIAmLazy, F5) as F5MemoGrp, Cast(Min(F5) as M) as MinMemo;
from whatever;
Group by 1,2,3,4,5;
order by 1,2,3,4 ;
into cursor blabla


There is a MD5 implementation on Ed Leafe's site which has better performance - not sure which function has theoretically more overlap.
Or you can combine both functions as in Sys(asAbove, F5) + MD5(F5) as F5MemoGrp - need perhaps to cast the results into Char-Types.

The hash function transforms the memo into a groupable "distinctability" and Min is used to make sure SQL syntax is observed at vfp9 compatibility.
Minimal danger of hash collisions can be combated either via different hash functions in series or scanning the table once for true identity at different Hash results - hashing is a multiedged tool which can cut you but just not realizing it is there leaves out one of the most potent tools available in programming.


>How would this look klike in the given situation?
>
>TIA
>Gerhard
>
>>>>
>>>If the information in the memo is less than 254 characters, then you can use these 254 chars and use distinct. Otherwise there is no way without a primary key.
>>
>>Coming in late and realizing that in another thread you argued for the cleaner solution of a PK: "No Way" is simply not true. Hashing is typically used in such situations.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform