Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: SQL Results

by Speedy (Monk)
on Feb 12, 2002 at 04:39 UTC ( [id://144782]=note: print w/replies, xml ) Need Help??

in reply to SQL Results

If you use a hash technique to remove duplicates, be careful of the case. Otherwise will be different from, and John john will get two copies of the email.

When saving email addresses from Web forms I generally make the stored results lower case.

Replies are listed 'Best First'.
Re: Re: SQL Results
by theorbtwo (Prior) on Feb 12, 2002 at 13:17 UTC
(jeffa) 2Re: SQL Results
by jeffa (Bishop) on Feb 12, 2002 at 15:29 UTC
    Most correct about case!

    Here is one way to elimate 'would-be' duplicates who simply are not because of case sensitivity:

    use strict; my %unique; my @email = qw( CAPTELO@microshaft.con ); for (@email) { my $key = lc $_; $unique{$key} = $_ unless ($unique{$key} and $unique{$key} =~ /[A-Z +]/); } print join("\n", values %unique), "\n";
    Yields the list:
    Of course, this is NOT perfect. Just some random thoughts if you will. ;) If you are not concerned with the extra overhead of space, i recommend storing the email address twice: once as it is, and once all lower-cased. Then you could issue a SQL statement like:
    SELECT distinct lc_email, email, ...
    and only use the 'email' column. Actually, even better might be performing a comparison before you insert the email address - make sure that a lower case version of the candidate email address does not already exist in the database first.


    (the triplet paradiddle with high-hat)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://144782]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-05-30 02:52 GMT
Find Nodes?
    Voting Booth?

    No recent polls found