|
Posted by Steve on 09/12/07 03:33
"axlq" <axlq@spamcop.net> wrote in message
news:fc73hv$q2c$3@blue.rahul.net...
> In article <46e64fd4$0$31120$6e1ede2f@read.cnntp.org>,
> gosha bine <stereofrog@gmail.com> wrote:
>>
>>you can use mysql regular expressions, e.g.
>>
>>select * from users where email rlike 'user([+][^@]+)?@example[.]com'
>
> Cool. That's just what I wanted to know. I feared the answer would
> involve something inefficient like reading in the entire column and
> processing it in php.
>
>>or, if you need this query often create an extra "canonical email"
>>column in the database.
>
> I was thinking of that solution too, but adding a redundant column,
> didn't seem as elegant as constructing a query to work with what I
> have.
i think what he's suggesting is not a redundant column. rather, a normalized
structure. one where an "email address" column contained only email
addresses (minus any other magic data you are combining with it). your "key"
in user+key@domain should be in its own column and given a well fitted name
that describes briefly what "key" is.
Navigation:
[Reply to this message]
|