Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL GROUP BY with MEMO-Field in Fieldlist
Message
From
17/11/2013 11:13:34
 
 
To
16/11/2013 07:48:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01587998
Message ID:
01588171
Views:
132
Danke Thomas.

>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.
Gerhard Schmidbauer
URANUS Software GmbH
Previous
Reply
Map
View

Click here to load this message in the networking platform