Reply to Re: Help with query

Your name:

Reply:


Posted by _Raven on 09/20/06 17:51

That works perfectly! It was the INSTR that was throwing me off.

Thanks Aho!

"J.O. Aho" <user@example.net> wrote in message
news:4ndbnsF9u8kgU1@individual.net...
> _Raven wrote:
>> I want to search the database for users who have email addresses whose
>> email username matches their stored username.
>>
>> So assuming my table is like so:
>>
>> TABLE `users`
>> id | username | email
>> 1 | jim | user@domain.com
>> 2 | bob | bob@domain.com
>> 3 | jen | jen13@domain.com
>>
>> So I want to search like "SELECT * from `users` where
>> email=username@userdomain.com", which in the case above would return row
>> #2 only, as user bob has email bob@domain.com, and not row 1 as email
>> username is nowhere near the username, and not row 3 as this username
>> does not match 100%.
>>
>> I know I will need to use regex and all that, I'm just not sure about how
>> to correctly set up the query itself to get the correct records.
>
> You could try with
>
> SELECT email FROM users WHERE username=SUBSTR(eMail,1,INSTR(eMail,'@')-1);
>
>
> //Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация