Re: help with MySQL SELECT statement
Kent, Thursday, July 11, 2002, 9:22:52 PM, you wrote: KH I would use this query: KH SELECT DISTINCT SUBSTRING(email,LOCATE('@', email) ) FROM AddressList ; So? Syntax of your SQL statement is correct. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: help with MySQL SELECT statement
Use SELECT DISTINCT. Matthew Scarrow ComIT Solutions Inc. www.comit.ca Phone: 519-442-0100 Fax: 519-442-0429 -Original Message- From: Kirk Babb [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 9:59 PM To: [EMAIL PROTECTED] Subject: help with MySQL SELECT statement Easy question I hope, relatively new user ( 6 months) here wanting to know how to fashion a MySQL select statement based on the following: there is a list of managers and their email addresses. This list changes all the time as we add and subtract different companies from the db. I would like to check the domain name of a form submitted email address against the list of domain names in the db. But I don't want to select the entire email list (1000's) when there are probably only 100 max different domain names (i.e. alltel.com, ualr.edu, etc.). Is there a way to do this? It would lighten the server load and the download times for the form page if possible. thanks! Kirk - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: help with MySQL SELECT statement
wait, how will the MySQL SELECT DISTINCT pick only one between these two addresses (as an example): [EMAIL PROTECTED] [EMAIL PROTECTED] I only need one email address each for alltel.com, one for ualr.edu, one for target.com, etc. when there might be 50 email addresses from each of those domains. I intend to then parse the adresses leaving only a list of whatever.coms which I will stick into an array for my validation function to use. Or am I making a mountain out of a molehill here? TIA -Kirk - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: help with MySQL SELECT statement
I'm not exactly sure if this is the right syntax. I can see that maybe a couple of domains would get cut out of this if there spelt almost the same. What you need to find out is the char count of the smallest domain name. Then replace smallestdomain with that number. What the rest of the select statement does is only get the last so many chars up to the smallest domain name and then the distinct will only return those that are not the same. I'm sure you can work around with this and find something that will do exactly what you want. SELECT DISTINCT email, substring(email,LENGTH(email)-smallestdomain, smallestdomain) as domain from tbl_emails; Matthew Scarrow ComIT Solutions Inc. www.comit.ca Phone: 519-442-0100 Fax: 519-442-0429 -Original Message- From: Kirk Babb [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 10:20 PM To: [EMAIL PROTECTED] Subject: Re: help with MySQL SELECT statement wait, how will the MySQL SELECT DISTINCT pick only one between these two addresses (as an example): [EMAIL PROTECTED] [EMAIL PROTECTED] I only need one email address each for alltel.com, one for ualr.edu, one for target.com, etc. when there might be 50 email addresses from each of those domains. I intend to then parse the adresses leaving only a list of whatever.coms which I will stick into an array for my validation function to use. Or am I making a mountain out of a molehill here? TIA -Kirk - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php